Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove union widening for enum string literals in typescript definitions #4374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Zenith00
Copy link
Member

@Zenith00 Zenith00 commented Mar 17, 2023

Removes string type from generated enum string literal unions. There's additional discussion and motivation in the noted issue,.

Widening the union like this is aggressively optimized by typescript into a string type, which renders the enum largely useless, both in type hinting and also at compile-time.

(Fixes #1624)

Checklist
  • npm run test passes
  • changelog is added, npm run add-change

@Zenith00 Zenith00 requested a review from a team as a code owner March 17, 2023 18:42
@Zenith00 Zenith00 changed the title Remove union widening for enum string literals in typescript definitions (Fixes #1624) Remove union widening for enum string literals in typescript definitions Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript: define string literal types for fixed-vocabulary fields
1 participant