Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ts5.0] Better inlining of constants in enums (#15379)
- Loading branch information
1 parent
ca52e08
commit 52ccb06
Showing
6 changed files
with
196 additions
and
88 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
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
19 changes: 19 additions & 0 deletions
19
packages/babel-plugin-transform-typescript/test/fixtures/enum/ts5.0-const-foldable/input.ts
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,19 @@ | ||
// ts 5.0 feature | ||
|
||
const BaseValue = 10; | ||
const Prefix = "/data"; | ||
const enum Values { | ||
First = BaseValue, // 10 | ||
Second, // 11 | ||
Third, // 12 | ||
} | ||
|
||
const xxx = 100 + Values.First; | ||
const yyy = xxx; | ||
|
||
const enum Routes { | ||
Parts = `${Prefix}/parts`, // "/data/parts" | ||
Invoices = `${Prefix}/invoices`, // "/data/invoices" | ||
x = `${Values.First}/x`, | ||
y = `${yyy}/y`, | ||
} |
Oops, something went wrong.