Comfy-Org / Comfy-Org/ComfyUI_frontend

Evaluate a shared TypeScript ValueOf<T> utility

Open
#14,803 1 comment 1 reaction 1 assignee Claimed by @ryan-di View on GitHub
developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

Evaluate and introduce a shared TypeScript utility for deriving a union from an object's values, such as `ValueOf`.

## Rationale

`src/platform/assets/components/mediaAssetViewOptions.ts` currently derives `MediaAssetViewMode` inline from `MEDIA_ASSET_VIEW_MODE`. A shared utility may reduce repeated type expressions, but it should be added only after confirming that other code has concrete consumers.

## Affected areas

- TypeScript utility module location to be determined.
- `src/platform/assets/components/mediaAssetViewOptions.ts`
- Other TypeScript modules with equivalent object-value union types, if applicable.

## Required changes

1. Search the codebase for equivalent object-value union type expressions.
2. Decide whether there are sufficient concrete consumers for a shared `ValueOf` utility.
3. If the utility is justified, add it in an appropriate shared TypeScript utility module.
4. Update applicable consumers, including `mediaAssetViewOptions.ts`, with minimal scope.
5. Keep the utility non-exported unless it has concrete external consumers that require an export.
6. If the utility is not justified, remove the TODO from `mediaAssetViewOptions.ts`.

## Acceptance criteria

- The codebase has a documented decision to add or not add `ValueOf`.
- No unused public exports are introduced.
- Any affected TypeScript types remain type-safe.
- Relevant tests and static checks pass.

## Backlinks

- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/14765
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/14765#discussion_r3718685351
- Requested by: @ryan-di

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.