forked from babel/babel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
Infinity
in enums (babel#15774)
fix
- Loading branch information
1 parent
cc85b60
commit b7faa90
Showing
4 changed files
with
30 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
11 changes: 11 additions & 0 deletions
11
packages/babel-plugin-transform-typescript/test/fixtures/regression/15768/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,11 @@ | ||
const v = 42; | ||
const v2 = Infinity; | ||
var Infinity = 1; // Known inconsistencies | ||
enum StateEnum { | ||
okay = 0, | ||
neg = -Infinity, | ||
pos = Infinity, | ||
nan = NaN, | ||
ext = v, | ||
ext2 = v2, | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-transform-typescript/test/fixtures/regression/15768/options.json
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,3 @@ | ||
{ | ||
"plugins": ["transform-typescript"] | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/babel-plugin-transform-typescript/test/fixtures/regression/15768/output.js
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,12 @@ | ||
const v = 42; | ||
const v2 = Infinity; | ||
var Infinity = 1; // Known inconsistencies | ||
var StateEnum = /*#__PURE__*/function (StateEnum) { | ||
StateEnum[StateEnum["okay"] = 0] = "okay"; | ||
StateEnum[StateEnum["neg"] = -Infinity] = "neg"; | ||
StateEnum[StateEnum["pos"] = Infinity] = "pos"; | ||
StateEnum[StateEnum["nan"] = NaN] = "nan"; | ||
StateEnum[StateEnum["ext"] = 42] = "ext"; | ||
StateEnum[StateEnum["ext2"] = 1] = "ext2"; | ||
return StateEnum; | ||
}(StateEnum || {}); |