refactor: improve type safety patterns from @ts-expect-error cleanup

Amp-Thread-ID: https://ampcode.com/threads/T-019bb3bd-f607-735a-b1a8-fce5fe4f0125
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
DrJKL
2026-01-12 12:14:10 -08:00
parent 4ef1fd984b
commit 7c063676be
11 changed files with 237 additions and 148 deletions

View File

@@ -37,6 +37,7 @@ import type {
NodeExecutionOutput,
ResultItem
} from '@/schemas/apiSchema'
import type { WorkflowAsGraph } from '@/types/workflowSchemaTypes'
import {
type ComfyNodeDef as ComfyNodeDefV1,
isComboInputSpecV1,
@@ -1194,12 +1195,8 @@ export class ComfyApp {
}
try {
// TODO: Align ComfyWorkflowJSON (Zod schema) with ISerialisedGraph (litegraph types)
// The schemas are structurally compatible at runtime but TypeScript can't verify this.
// See: https://github.com/Comfy-Org/ComfyUI_frontend/issues/XXXX
this.rootGraph.configure(
graphData as Parameters<typeof this.rootGraph.configure>[0]
)
// Type cast: ComfyWorkflowJSON → WorkflowAsGraph (see WorkflowAsGraph docs)
this.rootGraph.configure(graphData as WorkflowAsGraph)
// Save original renderer version before scaling (it gets modified during scaling)
const originalMainGraphRenderer =