[Type] Disallow type upcasting for node input spec (#2790)

This commit is contained in:
Chenlei Hu
2025-03-01 16:58:45 -05:00
committed by GitHub
parent bca0af82a3
commit 09ab14ac81
20 changed files with 136 additions and 109 deletions

View File

@@ -74,11 +74,13 @@ export const useLitegraphService = () => {
if (widgetType === 'COMBO') {
Object.assign(
config,
// @ts-expect-error InputSpec is not typed correctly
app.widgets.COMBO(this, inputName, inputData, app) || {}
)
} else {
Object.assign(
config,
// @ts-expect-error InputSpec is not typed correctly
app.widgets[widgetType](this, inputName, inputData, app) || {}
)
}
@@ -95,6 +97,7 @@ export const useLitegraphService = () => {
...shapeOptions,
localized_name: st(nameKey, inputName)
}
// @ts-expect-error InputSpec is not typed correctly
this.addInput(inputName, type, inputOptions)
widgetCreated = false
}
@@ -104,15 +107,19 @@ export const useLitegraphService = () => {
if (!inputIsRequired) {
config.widget.options.inputIsOptional = true
}
// @ts-expect-error InputSpec is not typed correctly
if (inputData[1]?.forceInput) {
config.widget.options.forceInput = true
}
// @ts-expect-error InputSpec is not typed correctly
if (inputData[1]?.defaultInput) {
config.widget.options.defaultInput = true
}
// @ts-expect-error InputSpec is not typed correctly
if (inputData[1]?.advanced) {
config.widget.advanced = true
}
// @ts-expect-error InputSpec is not typed correctly
if (inputData[1]?.hidden) {
config.widget.hidden = true
}