From 2595d12a8463cc485a6e2b7c388dfcf99f41449d Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 14 Jun 2024 09:55:33 -0400 Subject: [PATCH] Re-enable TSC on build (#5) * Fix fall through * Re-enable tsc --- package.json | 2 +- src/scripts/domWidget.ts | 3 +++ src/scripts/widgets.ts | 2 ++ tsconfig.json | 5 ++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 77a24cad8..082ccf683 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build", + "build": "tsc && vite build", "test": "cd tests-ui && npm run test", "preview": "vite preview" }, diff --git a/src/scripts/domWidget.ts b/src/scripts/domWidget.ts index 9c19c7034..d3fdbf7d0 100644 --- a/src/scripts/domWidget.ts +++ b/src/scripts/domWidget.ts @@ -193,7 +193,9 @@ function computeSize(size: [number, number]): void { // Override the compute visible nodes function to allow us to hide/show DOM elements when the node goes offscreen const elementWidgets = new Set(); +//@ts-ignore const computeVisibleNodes = LGraphCanvas.prototype.computeVisibleNodes; +//@ts-ignore LGraphCanvas.prototype.computeVisibleNodes = function (): LGraphNode[] { const visibleNodes = computeVisibleNodes.apply(this, arguments); for (const node of app.graph._nodes) { @@ -228,6 +230,7 @@ export function addDomClippingSetting(): void { }); } +//@ts-ignore LGraphNode.prototype.addDOMWidget = function ( name: string, type: string, diff --git a/src/scripts/widgets.ts b/src/scripts/widgets.ts index 9d52a4550..80f7745b7 100644 --- a/src/scripts/widgets.ts +++ b/src/scripts/widgets.ts @@ -142,6 +142,7 @@ export function addValueControlWidgets(node, targetWidget, defaultValue = "rando break; case "randomize": current_index = Math.floor(Math.random() * current_length); + break; default: break; } @@ -173,6 +174,7 @@ export function addValueControlWidgets(node, targetWidget, defaultValue = "rando break; case "randomize": targetWidget.value = Math.floor(Math.random() * range) * (targetWidget.options.step / 10) + min; + break; default: break; } diff --git a/tsconfig.json b/tsconfig.json index a09c4601a..24abbe971 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,6 +14,7 @@ "noUnusedLocals": false, "noUnusedParameters": false, "noFallthroughCasesInSwitch": true, + "downlevelIteration": true, /* AllowJs during migration phase */ "allowJs": true, @@ -21,7 +22,9 @@ "paths": { "*": ["src/*"], }, - "typeRoots": ["src/types", "node_modules/@types"] + "typeRoots": ["src/types", "node_modules/@types"], + "outDir": "./dist", + "rootDir": "./src", }, "include": ["src/**/*", "src/types/**/*.d.ts"], }