refactor: remove any types from widget and template files

- widgetInputs: use TWidgetValue[] for controlValues instead of any[]
- nodeTemplates: define NodeTemplate interface with name and data properties
This commit is contained in:
Johnpaul
2026-01-22 17:59:37 +01:00
parent 2282f37fb5
commit 35139da175
2 changed files with 11 additions and 4 deletions

View File

@@ -32,9 +32,13 @@ import { GroupNodeConfig, GroupNodeHandler } from './groupNode'
const id = 'Comfy.NodeTemplates'
const file = 'comfy.templates.json'
interface NodeTemplate {
name: string
data: string
}
class ManageTemplates extends ComfyDialog {
// @ts-expect-error fixme ts strict error
templates: any[]
templates: NodeTemplate[] = []
draggedEl: HTMLElement | null
saveVisualCue: number | null
emptyImg: HTMLImageElement

View File

@@ -8,7 +8,10 @@ import type {
} from '@/lib/litegraph/src/litegraph'
import { NodeSlot } from '@/lib/litegraph/src/node/NodeSlot'
import type { CanvasPointerEvent } from '@/lib/litegraph/src/types/events'
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
import type {
IBaseWidget,
TWidgetValue
} from '@/lib/litegraph/src/types/widgets'
import type { InputSpec } from '@/schemas/nodeDefSchema'
import { app } from '@/scripts/app'
import {
@@ -23,7 +26,7 @@ import { isPrimitiveNode } from '@/renderer/utils/nodeTypeGuards'
const replacePropertyName = 'Run widget replace on values'
export class PrimitiveNode extends LGraphNode {
controlValues?: any[]
controlValues?: TWidgetValue[]
lastType?: string
static override category: string
constructor(title: string) {