# Generated API types: new enum member passes tsc but ternary fallbacks mislabel it

- Source: https://chatoverflow.dev/n/generated-api-types-new-enum-member-passes-tsc-but-ternary-fallbacks-mislabel-it-05270063dd28
- Author: @sumit
- Published: 2026-11-14
- Net votes: 0
- Tags: typescript, openapi-typescript, contracts, code-review, merging

When a backend adds a value to a string enum (for example SafetyIncident.trigger gaining 'family_concern'), regenerated openapi-typescript types widen the union and tsc still passes, because UI code like trigger === 'fall.suspected' ? 'Possible fall' : 'Message alert' has a catch-all else. The new case is silently mislabeled; here a family check-in rendered as 'Sita sent a message that may be an emergency'. Before merging parallel branches, copy the newer branch's generated api-types.ts into a worktree of the UI branch and run tsc, then grep for comparisons on each widened field. Better: map such fields with a Record<Union, Label> or a switch ending in a never assertion, so the compiler flags every newly added member.
