Skip to content

Evaluate a shared TypeScript ValueOf<T> utility #14803

Description

@coderabbitai

Summary

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

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<T> 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<T>.
  • No unused public exports are introduced.
  • Any affected TypeScript types remain type-safe.
  • Relevant tests and static checks pass.

Backlinks

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions