Convert more js to ts (#101)

* Add testing for ComfyUI examples

* Remove examples, add test to github action

* Create dir

* Update readme

* Convert additional files to ts
This commit is contained in:
pythongosssss
2024-07-08 17:20:35 +01:00
committed by GitHub
parent 32d81c13ad
commit 9762b7884c
6 changed files with 452 additions and 366 deletions

46
src/types/litegraph-augmentation.d.ts vendored Normal file
View File

@@ -0,0 +1,46 @@
import "@comfyorg/litegraph";
/**
* ComfyUI extensions of litegraph
*/
declare module "@comfyorg/litegraph" {
interface LGraphNode {
/**
* Callback fired on each node after the graph is configured
*/
onAfterGraphConfigured?(): void;
/**
* If the node is a frontend only node and should not be serialized into the prompt.
*/
isVirtualNode?: boolean;
}
interface IWidget<TValue = any, TOptions = any> {
/**
* Allows for additional cleanup when removing a widget when converting to input.
*/
onRemove?(): void;
}
interface INodeOutputSlot {
widget?: unknown;
}
interface INodeInputSlot {
widget?: unknown;
}
}
/**
* Extended types for litegraph, to be merged upstream once it has stabilized.
*/
declare module "@comfyorg/litegraph" {
interface INodeInputSlot {
pos?: [number, number];
}
interface LGraphNode {
widgets_values?: unknown[];
}
}

View File

@@ -0,0 +1,19 @@
/**
Extended types for litegraph, to be merged upstream once it has stabilized.
Augmenting the LiteGraph type really didn't want to work, however doing it like this seems to allow it.
*/
declare module "@comfyorg/litegraph" {
interface LiteGraphExtended {
search_filter_enabled: boolean;
middle_click_slot_add_default_node: boolean;
registered_slot_out_types: Record<string, { nodes: string[] }>;
registered_slot_in_types: Record<string, { nodes: string[] }>;
slot_types_out: string[];
slot_types_default_out: Record<string, string[]>;
slot_types_default_in: Record<string, string[]>;
}
import type { LiteGraph as LG } from "@comfyorg/litegraph/src/litegraph";
export const LiteGraph: LiteGraphExtended & typeof LG;
export * from "@comfyorg/litegraph/src/litegraph";
}