Skip to content

Commit

Permalink
Re-enable TSC on build (#5)
Browse files Browse the repository at this point in the history
* Fix fall through

* Re-enable tsc
  • Loading branch information
huchenlei committed Jun 14, 2024
1 parent 92b08c0 commit 2595d12
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
3 changes: 3 additions & 0 deletions src/scripts/domWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -228,6 +230,7 @@ export function addDomClippingSetting(): void {
});
}

//@ts-ignore
LGraphNode.prototype.addDOMWidget = function (
name: string,
type: string,
Expand Down
2 changes: 2 additions & 0 deletions src/scripts/widgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@
"noUnusedLocals": false,
"noUnusedParameters": false,
"noFallthroughCasesInSwitch": true,
"downlevelIteration": true,

/* AllowJs during migration phase */
"allowJs": true,
"baseUrl": ".",
"paths": {
"*": ["src/*"],
},
"typeRoots": ["src/types", "node_modules/@types"]
"typeRoots": ["src/types", "node_modules/@types"],
"outDir": "./dist",
"rootDir": "./src",
},
"include": ["src/**/*", "src/types/**/*.d.ts"],
}

0 comments on commit 2595d12

Please sign in to comment.