mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 18:22:40 +00:00
fix: properly type extractWorkflow return
Type `extractWorkflow` return as `ComfyWorkflowJSON | undefined` instead of `unknown` for better type safety downstream. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
* All distributions use the /jobs endpoint.
|
||||
*/
|
||||
|
||||
import type { ComfyWorkflowJSON } from '@/platform/workflow/validation/schemas/workflowSchema'
|
||||
import type { PromptId } from '@/schemas/apiSchema'
|
||||
|
||||
import type {
|
||||
@@ -139,8 +140,12 @@ export async function fetchJobDetail(
|
||||
* The workflow is nested at: workflow.extra_data.extra_pnginfo.workflow
|
||||
* Full workflow validation happens downstream via validateComfyWorkflow.
|
||||
*/
|
||||
export function extractWorkflow(job: JobDetail | undefined): unknown {
|
||||
export function extractWorkflow(
|
||||
job: JobDetail | undefined
|
||||
): ComfyWorkflowJSON | undefined {
|
||||
const parsed = zWorkflowContainer.safeParse(job?.workflow)
|
||||
if (!parsed.success) return undefined
|
||||
return parsed.data.extra_data?.extra_pnginfo?.workflow
|
||||
return parsed.data.extra_data?.extra_pnginfo?.workflow as
|
||||
| ComfyWorkflowJSON
|
||||
| undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user