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

typescript/es6-declarations outputs wide types for string/number values #904

Closed
iybaron opened this issue Dec 13, 2022 · 0 comments
Closed

Comments

@iybaron
Copy link

iybaron commented Dec 13, 2022

Problem:
Currently, the typescript/es6-declarations format assigns string tokens the type string, and number tokens the type number. As a result, tokens are un-assignable to stricter types, such as string literal unions, without type assertion. The assignment of type string to tokens with string values does not align with Typescript's built-in type inference, which assigns string-literal types to string variables.

Proposed Solution:
Add feature flag options.outputLiteralTypes to the typescript/es6-declarations format's interface. If this boolean option is set to true, tokens with string or number values will be assigned literal types in the outputted files.

PR: #857

@iybaron iybaron closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2022
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

No branches or pull requests

1 participant