mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 18:52:19 +00:00
fix: properly type extractWorkflow return value
Changed return type from `unknown` to `ComfyWorkflowJSON | undefined` so callers don't need type assertions. Validation still happens downstream in loadGraphData when the setting is enabled. Addresses DrJKL's review comment on PR 7170. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import type { ComfyWorkflowJSON } from '@/platform/workflow/validation/schemas/workflowSchema'
|
||||||
import type { PromptId } from '@/schemas/apiSchema'
|
import type { PromptId } from '@/schemas/apiSchema'
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
@@ -126,8 +127,13 @@ export async function fetchJobDetail(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Extracts workflow from job detail response */
|
/**
|
||||||
export function extractWorkflow(job: JobDetail | undefined): unknown {
|
* Extracts workflow from job detail response.
|
||||||
|
* Validation happens downstream in loadGraphData when the setting is enabled.
|
||||||
|
*/
|
||||||
|
export function extractWorkflow(
|
||||||
|
job: JobDetail | undefined
|
||||||
|
): ComfyWorkflowJSON | undefined {
|
||||||
const workflow = job?.workflow
|
const workflow = job?.workflow
|
||||||
if (!workflow || typeof workflow !== 'object') return undefined
|
if (!workflow || typeof workflow !== 'object') return undefined
|
||||||
const container = workflow as Record<string, unknown>
|
const container = workflow as Record<string, unknown>
|
||||||
@@ -135,5 +141,7 @@ export function extractWorkflow(job: JobDetail | undefined): unknown {
|
|||||||
if (!extraData || typeof extraData !== 'object') return undefined
|
if (!extraData || typeof extraData !== 'object') return undefined
|
||||||
const pnginfo = (extraData as Record<string, unknown>).extra_pnginfo
|
const pnginfo = (extraData as Record<string, unknown>).extra_pnginfo
|
||||||
if (!pnginfo || typeof pnginfo !== 'object') return undefined
|
if (!pnginfo || typeof pnginfo !== 'object') return undefined
|
||||||
return (pnginfo as Record<string, unknown>).workflow
|
return (pnginfo as Record<string, unknown>).workflow as
|
||||||
|
| ComfyWorkflowJSON
|
||||||
|
| undefined
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user