mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 22:59:14 +00:00
[TS] Fix / consolidate DOM widget types (#3830)
This commit is contained in:
20
src/types/litegraph-augmentation.d.ts
vendored
20
src/types/litegraph-augmentation.d.ts
vendored
@@ -32,15 +32,15 @@ declare module '@comfyorg/litegraph/dist/types/widgets' {
|
||||
}
|
||||
|
||||
interface IBaseWidget {
|
||||
onRemove?: () => void
|
||||
beforeQueued?: () => unknown
|
||||
afterQueued?: () => unknown
|
||||
onRemove?(): void
|
||||
beforeQueued?(): unknown
|
||||
afterQueued?(): unknown
|
||||
serializeValue?(node: LGraphNode, index: number): Promise<unknown> | unknown
|
||||
|
||||
/**
|
||||
* Refreshes the widget's value or options from its remote source.
|
||||
*/
|
||||
refresh?: () => unknown
|
||||
refresh?(): unknown
|
||||
|
||||
/**
|
||||
* If the widget supports dynamic prompts, this will be set to true.
|
||||
@@ -54,6 +54,8 @@ declare module '@comfyorg/litegraph/dist/types/widgets' {
|
||||
* ComfyUI extensions of litegraph
|
||||
*/
|
||||
declare module '@comfyorg/litegraph' {
|
||||
import type { IBaseWidget } from '@comfyorg/litegraph/dist/types/widgets'
|
||||
|
||||
interface LGraphNodeConstructor<T extends LGraphNode = LGraphNode> {
|
||||
type?: string
|
||||
comfyClass: string
|
||||
@@ -63,13 +65,9 @@ declare module '@comfyorg/litegraph' {
|
||||
new (): T
|
||||
}
|
||||
|
||||
interface TextWidget {
|
||||
dynamicPrompts?: boolean
|
||||
}
|
||||
|
||||
interface BaseWidget {
|
||||
serializeValue?(node: LGraphNode, index: number): Promise<unknown> | unknown
|
||||
}
|
||||
// Add interface augmentations into the class itself
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||
interface BaseWidget extends IBaseWidget {}
|
||||
|
||||
interface LGraphNode {
|
||||
constructor: LGraphNodeConstructor
|
||||
|
||||
Reference in New Issue
Block a user