Enable some TS consistency lints

This commit is contained in:
Keavon Chambers
2022-08-25 19:00:23 -07:00
parent 881ad667d7
commit 1e74ccb4f8
11 changed files with 66 additions and 42 deletions
+23 -6
View File
@@ -241,10 +241,10 @@ export class UpdateDocumentLayerTreeStructure extends JsMessage {
}
}
interface DataBuffer {
type DataBuffer = {
pointer: bigint;
length: bigint;
}
};
export function newUpdateDocumentLayerTreeStructure(input: { dataBuffer: DataBuffer }, wasm: WasmRawInstance): UpdateDocumentLayerTreeStructure {
const pointerNum = Number(input.dataBuffer.pointer);
@@ -519,7 +519,7 @@ export class PopoverButton extends WidgetProps {
text!: string;
}
export interface RadioEntryData {
export type RadioEntryData = {
value?: string;
label?: string;
icon?: IconName;
@@ -527,7 +527,7 @@ export interface RadioEntryData {
// Callbacks
action?: () => void;
}
};
export type RadioEntries = RadioEntryData[];
export class RadioInput extends WidgetProps {
@@ -573,6 +573,23 @@ export class TextButton extends WidgetProps {
disabled!: boolean;
}
export type TextButtonWidget = {
tooltip?: string;
message?: string | object;
callback?: () => void;
props: {
kind: "TextButton";
label: string;
icon?: string;
emphasized?: boolean;
minWidth?: number;
disabled?: boolean;
// Callbacks
// `action` is used via `IconButtonWidget.callback`
};
};
export class TextInput extends WidgetProps {
value!: string;
@@ -645,10 +662,10 @@ function hoistWidgetHolders(widgetHolders: any[]): Widget[] {
// WIDGET LAYOUT
export interface WidgetLayout {
export type WidgetLayout = {
layoutTarget: unknown;
layout: LayoutGroup[];
}
};
export function defaultWidgetLayout(): WidgetLayout {
return {
@@ -4,12 +4,10 @@ import { type WasmEditorInstance, type WasmRawInstance } from "@/wasm-communicat
import { type JsMessageType, messageMakers, type JsMessage } from "@/wasm-communication/messages";
type JsMessageCallback<T extends JsMessage> = (messageData: T) => void;
type JsMessageCallbackMap = {
// Don't know a better way of typing this since it can be any subclass of JsMessage
// The functions interacting with this map are strongly typed though around JsMessage
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[message: string]: JsMessageCallback<any> | undefined;
};
// Don't know a better way of typing this since it can be any subclass of JsMessage
// The functions interacting with this map are strongly typed though around JsMessage
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type JsMessageCallbackMap = Record<string, JsMessageCallback<any> | undefined>;
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export function createSubscriptionRouter() {