Comfy-Org / Comfy-Org/ComfyUI_frontend

Tighten `preview_output` type in `@comfyorg/ingest-types` (JobEntry / JobDetailResponse)

Open
#11,205 0 comments 0 reactions 1 assignee Claimed by @DrJKL View on GitHub
Public API
Dominant language
TypeScript
Stars
2k
Forks
702
Avg merge
1d 8h
Merged PRs (30d)
512

Description

## Background

`JobEntry.preview_output` (and the equivalent field in `JobDetailResponse`) is currently typed as `{ [key: string]: unknown }` in both the generated TypeScript types and the Zod schema:

- `packages/ingest-types/src/types.gen.ts` – `preview_output?: { [key: string]: unknown }`
- `packages/ingest-types/src/zod.gen.ts` – `preview_output: z.record(z.unknown()).optional()`

Because the shape is untyped, consumers are forced to use unsafe casts like `as MockPreviewOutput` (see `browser_tests/fixtures/helpers/AssetScenarioHelper.ts` lines 62–66).

## Expected fields

Based on actual usage across the codebase, `preview_output` carries:

| Field | Type | Notes |
|---|---|---|
| `filename` | `string` | Base filename of the preview asset |
| `subfolder` | `string` | Subfolder under the output root |
| `type` | `'output' \| 'input' \| 'temp'` | ComfyUI output type |
| `nodeId` | `string` | Source node id |
| `mediaType` | `'images' \| 'video' \| 'audio' \| 'text'` | Media category |
| `display_name` | `string \| undefined` | Human-readable name override |

## Requested change

Update the upstream OpenAPI schema (the source fed into `openapi-ts.config.ts`) so that `preview_output` is described with the above named properties instead of a free-form object. After regenerating, `types.gen.ts` and `zod.gen.ts` will carry the structured type and the unsafe cast in `AssetScenarioHelper.ts` can be removed.

## References

- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10630
- Comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10630#discussion_r3076185344
- Requested by: @DrJKL

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11205-Tighten-preview_output-type-in-comfyorg-ingest-types-JobEntry-JobDetailRespon-3416d73d36508188922bfb0b451c4732) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.