Comfy-Org / Comfy-Org/ComfyUI_frontend

[RFC] Consolidate `src/types/` — migrate domain types to their domains

Open
#11,062 0 comments 0 reactions 0 assignees View on GitHub
Public API refactor
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Problem

`src/types/` contains 21 non-declaration type files in a flat directory. Many are domain-specific:

- `comfy.ts` (269L): Extension hook definitions — belongs with the extension system
- `extensionTypes.ts` (139L): `ExtensionManager`, sidebar/bottom panel types — belongs with extensions
- `index.ts` (92L): Re-export barrel file that re-exports from `@/scripts/app`, `@/scripts/api`, `@/schemas/` — acts as a public API facade
- `authTypes.ts`: Auth domain
- `nodeIdentification.ts`, `nodeSource.ts`, `nodeDefAugmentation.ts`, `nodeOrganizationTypes.ts`: Node catalog domain
- `searchBoxTypes.ts`, `searchServiceTypes.ts`: Search domain
- `queue.ts`: Queue domain
- `widgetTypes.ts`, `simplifiedWidget.ts`: Widget/renderer domain
- `workflowMenuItem.ts`, `metadataTypes.ts`: Workflow domain

## Proposed Deepening

1. Move domain types into their respective domain directories (e.g., `nodeIdentification.ts` → `platform/nodeCatalog/types/`)
2. Move `comfy.ts` and `extensionTypes.ts` into an `extensions/` or `platform/extensions/` domain
3. Keep `index.ts` as the public API type facade (this is the extension contract), but have it import from domain locations
4. Generic types (`treeExplorerTypes.ts`, `navTypes.ts`) can remain or move to `base/`

## Migration Plan

1. Coordinate with Issue #11020 (node catalog) and store migrations
2. Move one domain cluster per PR
3. Maintain re-exports from old paths during transition

## Testing Strategy

- `pnpm typecheck` passes after each move
- Public API contract (`types/index.ts`) continues to export all existing types

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11062-RFC-Consolidate-src-types-migrate-domain-types-to-their-domains-33e6d73d36508103979eecc855ef60a3) 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.