-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(jsii): prohibit exported const enums (#372)
'const enums' are inlined at the usage site by TypeScript and so the generated type will not be in the JavaScript source code in the assembly, even though the declaration will be there. This leads to "symbol not found" errors upon trying to load it. Ref: https://www.typescriptlang.org/docs/handbook/enums.html#const-enums Related: aws/aws-cdk#1969
- Loading branch information
1 parent
e429c41
commit 5a94825
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
///!MATCH_ERROR: Exported enum cannot be declared 'const' | ||
|
||
export const enum NotAllowed { | ||
ThisEnum, | ||
GetsInlined, | ||
AndSoItGetsLost, | ||
ForJsii | ||
} |