Skip to content

Commit 9762b78

Browse files
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
1 parent 32d81c1 commit 9762b78

File tree

6 files changed

+452
-366
lines changed

6 files changed

+452
-366
lines changed
File renamed without changes.

src/extensions/core/rerouteNode.js renamed to src/extensions/core/rerouteNode.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
import { app } from "../../scripts/app";
22
import { mergeIfValid, getWidgetConfig, setWidgetConfig } from "./widgetInputs";
3-
import { LiteGraph, LGraphCanvas } from "@comfyorg/litegraph";
3+
import { LiteGraph, LGraphCanvas, LGraphNode } from "@comfyorg/litegraph";
44

55
// Node that allows you to redirect connections for cleaner graphs
66

77
app.registerExtension({
88
name: "Comfy.RerouteNode",
99
registerCustomNodes(app) {
10+
interface RerouteNode extends LGraphNode {
11+
__outputType?: string;
12+
}
13+
1014
class RerouteNode {
15+
static category: string | undefined;
16+
static defaultVisibility = false;
17+
1118
constructor() {
1219
if (!this.properties) {
1320
this.properties = {};
@@ -227,7 +234,7 @@ app.registerExtension({
227234
this.properties.showOutputText = !this.properties.showOutputText;
228235
if (this.properties.showOutputText) {
229236
this.outputs[0].name =
230-
this.__outputType || this.outputs[0].type;
237+
this.__outputType || (this.outputs[0].type as string);
231238
} else {
232239
this.outputs[0].name = "";
233240
}
@@ -273,7 +280,7 @@ app.registerExtension({
273280
app.graph.setDirtyCanvas(true, true);
274281
}
275282

276-
computeSize() {
283+
computeSize(): [number, number] {
277284
return [
278285
this.properties.showOutputText && this.outputs && this.outputs.length
279286
? Math.max(

src/extensions/core/slotDefaults.js renamed to src/extensions/core/slotDefaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ app.registerExtension({
5959

6060
var outputs = nodeData["output"];
6161
for (const key in outputs) {
62-
var type = outputs[key];
62+
var type = outputs[key] as string;
6363
if (!(type in this.slot_types_default_in)) {
6464
this.slot_types_default_in[type] = ["Reroute"]; // ["Reroute", "Primitive"]; primitive doesn't always work :'()
6565
}

0 commit comments

Comments
 (0)