Implement enums as type union but still have a dedicated type #2740
Labels
closed-for-staleness
effort/large
Large work item – several weeks of effort
feature-request
A feature should be added or improved.
module/compiler
Issues affecting the JSII compiler
module/runtime
Issues affecting the `jsii-runtime`
p2
🚀 Feature Request
Affected Languages
TypeScript
orJavascript
Python
Java
C#
,F#
, ...)Go
General Information
Description
Simplify Typescript enum generation based on a type union. This issue was prompted by this discussion: https://github.com/cdk8s-team/cdk8s/issues/215:
Benfits:
Proposed Solution
Example:
Current emitted code:
Proposed change:
This would be a breaking change but migration would be trivial. At the cost of one extra type - the union of the current enum and the union of the bare strings - the change can be made fully backward compatible:
The text was updated successfully, but these errors were encountered: