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.
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: https://github.com/amzn/style-dictionary/pull/857