diff --git a/src/LGraph.ts b/src/LGraph.ts index 06cfe6b50..d47f13a9f 100644 --- a/src/LGraph.ts +++ b/src/LGraph.ts @@ -48,6 +48,11 @@ export interface LGraphConfig { links_ontop?: any } +export interface LGraphExtra extends Dictionary { + reroutes?: SerialisableReroute[] + linkExtensions?: { id: number, parentId: number | undefined }[] +} + export interface BaseLGraph { readonly rootGraph: LGraph } @@ -119,7 +124,7 @@ export class LGraph implements LinkNetwork, BaseLGraph, Serialisable = {} + extra: LGraphExtra = {} /** @deprecated Deserialising a workflow sets this unused property. */ version?: number diff --git a/src/LGraphCanvas.ts b/src/LGraphCanvas.ts index 8b0c61457..8c9f64750 100644 --- a/src/LGraphCanvas.ts +++ b/src/LGraphCanvas.ts @@ -6033,7 +6033,7 @@ export class LGraphCanvas { dialog.close() } else if (e.key == "Enter") { if (selected instanceof HTMLElement) { - select(unescape(String(selected.dataset.type))) + select(unescape(String(selected.dataset["type"]))) } else if (first) { select(first) } else { @@ -6395,7 +6395,7 @@ export class LGraphCanvas { help.className += ` ${className}` } help.addEventListener("click", function () { - select(unescape(String(this.dataset.type))) + select(unescape(String(this.dataset["type"]))) }) helper.append(help) } diff --git a/src/LGraphGroup.ts b/src/LGraphGroup.ts index 762dad00d..5b159e915 100644 --- a/src/LGraphGroup.ts +++ b/src/LGraphGroup.ts @@ -61,9 +61,9 @@ export class LGraphGroup implements Positionable, IPinnable, IColorable { // TODO: Object instantiation pattern requires too much boilerplate and null checking. ID should be passed in via constructor. this.id = id ?? -1 this.title = title || "Group" - this.color = LGraphCanvas.node_colors.pale_blue - ? LGraphCanvas.node_colors.pale_blue.groupcolor - : "#AAA" + + const { pale_blue } = LGraphCanvas.node_colors + this.color = pale_blue ? pale_blue.groupcolor : "#AAA" } /** @inheritdoc {@link IColorable.setColorOption} */ diff --git a/src/canvas/MovingInputLink.ts b/src/canvas/MovingInputLink.ts index f66721241..e26ce7d60 100644 --- a/src/canvas/MovingInputLink.ts +++ b/src/canvas/MovingInputLink.ts @@ -10,7 +10,7 @@ import { LinkDirection } from "@/types/globalEnums" import { MovingLinkBase } from "./MovingLinkBase" export class MovingInputLink extends MovingLinkBase { - readonly toType = "input" + override readonly toType = "input" readonly node: LGraphNode readonly fromSlot: INodeOutputSlot diff --git a/src/canvas/MovingOutputLink.ts b/src/canvas/MovingOutputLink.ts index 01d15858d..fa1b675a8 100644 --- a/src/canvas/MovingOutputLink.ts +++ b/src/canvas/MovingOutputLink.ts @@ -10,7 +10,7 @@ import { LinkDirection } from "@/types/globalEnums" import { MovingLinkBase } from "./MovingLinkBase" export class MovingOutputLink extends MovingLinkBase { - readonly toType = "output" + override readonly toType = "output" readonly node: LGraphNode readonly fromSlot: INodeInputSlot diff --git a/src/canvas/ToOutputFromRerouteLink.ts b/src/canvas/ToOutputFromRerouteLink.ts index ec37819f0..ba3a6570f 100644 --- a/src/canvas/ToOutputFromRerouteLink.ts +++ b/src/canvas/ToOutputFromRerouteLink.ts @@ -14,7 +14,7 @@ export class ToOutputFromRerouteLink extends ToOutputRenderLink { network: LinkNetwork, node: LGraphNode, fromSlot: INodeInputSlot, - readonly fromReroute: Reroute, + override readonly fromReroute: Reroute, readonly linkConnector: LinkConnector, ) { super(network, node, fromSlot, fromReroute) diff --git a/src/subgraph/SubgraphSlotBase.ts b/src/subgraph/SubgraphSlotBase.ts index 0890ff7ed..2a876b230 100644 --- a/src/subgraph/SubgraphSlotBase.ts +++ b/src/subgraph/SubgraphSlotBase.ts @@ -21,7 +21,7 @@ export abstract class SubgraphSlot extends SlotBase implements SubgraphIO, Seria readonly linkIds: LinkId[] = [] - readonly boundingRect: Rect = [0, 0, 0, SubgraphSlot.defaultHeight] + override readonly boundingRect: Rect = [0, 0, 0, SubgraphSlot.defaultHeight] override get pos() { return this.#pos diff --git a/src/types/serialisation.ts b/src/types/serialisation.ts index 1bc9e8735..ee8363feb 100644 --- a/src/types/serialisation.ts +++ b/src/types/serialisation.ts @@ -8,7 +8,7 @@ import type { Point, Size, } from "../interfaces" -import type { LGraphConfig, LGraphState } from "../LGraph" +import type { LGraphConfig, LGraphExtra, LGraphState } from "../LGraph" import type { IGraphGroupFlags } from "../LGraphGroup" import type { NodeId, NodeProperty } from "../LGraphNode" import type { LiteGraph } from "../litegraph" @@ -53,7 +53,7 @@ export interface SerialisableGraph extends BaseExportedGraph { links?: SerialisableLLink[] floatingLinks?: SerialisableLLink[] reroutes?: SerialisableReroute[] - extra?: Dictionary + extra?: LGraphExtra } export type ISerialisableNodeInput = Omit & { @@ -114,9 +114,7 @@ export interface ISerialisedGraph extends BaseExportedGraph { floatingLinks?: SerialisableLLink[] groups: ISerialisedGroup[] version: typeof LiteGraph.VERSION - extra?: Dictionary & { - reroutes?: SerialisableReroute[] - } + extra?: LGraphExtra } /** diff --git a/src/widgets/KnobWidget.ts b/src/widgets/KnobWidget.ts index 45502b999..ecd975142 100644 --- a/src/widgets/KnobWidget.ts +++ b/src/widgets/KnobWidget.ts @@ -36,7 +36,7 @@ export class KnobWidget extends BaseWidget implements IKnobWidget { } } - get height(): number { + override get height(): number { return this.computedHeight || super.height } diff --git a/tsconfig.json b/tsconfig.json index f9d5d9f9e..32b603a7d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,6 +19,8 @@ "noUnusedParameters": false, "noFallthroughCasesInSwitch": true, "downlevelIteration": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, /* AllowJs during migration phase */ "allowJs": true,