[fix] Add definite assignment assertions to fix TypeScript errors

- Add ! definite assignment assertions to properties that were using declare
- This fixes TypeScript compilation errors while maintaining Babel compatibility
- Properties are guaranteed to be assigned at runtime
This commit is contained in:
snomiao
2025-09-04 22:33:03 +00:00
parent 0a892fcfc3
commit 078d75c3ba
6 changed files with 8 additions and 8 deletions

View File

@@ -12,7 +12,7 @@ import type { SubgraphInputNode } from './SubgraphInputNode'
* A virtual slot that simply creates a new input slot when connected to.
*/
export class EmptySubgraphInput extends SubgraphInput {
parent: SubgraphInputNode
parent!: SubgraphInputNode
constructor(parent: SubgraphInputNode) {
super(

View File

@@ -12,7 +12,7 @@ import type { SubgraphOutputNode } from './SubgraphOutputNode'
* A virtual slot that simply creates a new output slot when connected to.
*/
export class EmptySubgraphOutput extends SubgraphOutput {
parent: SubgraphOutputNode
parent!: SubgraphOutputNode
constructor(parent: SubgraphOutputNode) {
super(

View File

@@ -30,7 +30,7 @@ import { isNodeSlot, isSubgraphOutput } from './subgraphUtils'
* Functionally, however, when editing a subgraph, that "subgraph input" is the "origin" or "output side" of a link.
*/
export class SubgraphInput extends SubgraphSlot {
parent: SubgraphInputNode
parent!: SubgraphInputNode
events = new CustomEventTarget<SubgraphInputEventMap>()

View File

@@ -35,7 +35,7 @@ import type { SubgraphInput } from './SubgraphInput'
* An instance of a {@link Subgraph}, displayed as a node on the containing (parent) graph.
*/
export class SubgraphNode extends LGraphNode implements BaseLGraph {
inputs: (INodeInputSlot & Partial<ISubgraphInput>)[]
inputs!: (INodeInputSlot & Partial<ISubgraphInput>)[]
override readonly type: UUID
override readonly isVirtualNode = true as const

View File

@@ -29,7 +29,7 @@ import { isNodeSlot, isSubgraphInput } from './subgraphUtils'
* Functionally, however, when editing a subgraph, that "subgraph output" is the "target" or "input side" of a link.
*/
export class SubgraphOutput extends SubgraphSlot {
parent: SubgraphOutputNode
parent!: SubgraphOutputNode
override connect(
slot: INodeOutputSlot,

View File

@@ -63,10 +63,10 @@ export abstract class BaseWidget<TWidget extends IBaseWidget = IBaseWidget>
}
linkedWidgets?: IBaseWidget[]
name: string
options: TWidget['options']
name!: string
options!: TWidget['options']
label?: string
type: TWidget['type']
type!: TWidget['type']
y: number = 0
last_y?: number
width?: number