-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix references to enum values with merging (#16137)
* Add test * Fix `path.resolve()` usage in enum transform * Fix references to enum values with merging * One more test
- Loading branch information
1 parent
f8a98c7
commit 57535c3
Showing
5 changed files
with
51 additions
and
9 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
14 changes: 14 additions & 0 deletions
14
...gin-transform-typescript/test/fixtures/enum/enum-merging-inner-references-shadow/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,14 @@ | ||
const Cat = 10; | ||
const Dog = 20; | ||
|
||
enum Animals { | ||
Cat = 1 | ||
} | ||
|
||
enum Animals { | ||
Dog = 2 | ||
} | ||
|
||
enum Animals { | ||
CatDog = Cat | Dog | ||
} |
14 changes: 14 additions & 0 deletions
14
...in-transform-typescript/test/fixtures/enum/enum-merging-inner-references-shadow/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,14 @@ | ||
const Cat = 10; | ||
const Dog = 20; | ||
var Animals = /*#__PURE__*/function (Animals) { | ||
Animals[Animals["Cat"] = 1] = "Cat"; | ||
return Animals; | ||
}(Animals || {}); | ||
Animals = /*#__PURE__*/function (Animals) { | ||
Animals[Animals["Dog"] = 2] = "Dog"; | ||
return Animals; | ||
}(Animals || {}); | ||
Animals = /*#__PURE__*/function (Animals) { | ||
Animals[Animals["CatDog"] = 3] = "CatDog"; | ||
return Animals; | ||
}(Animals || {}); |
7 changes: 7 additions & 0 deletions
7
...bel-plugin-transform-typescript/test/fixtures/enum/enum-merging-inner-references/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,7 @@ | ||
enum Animals { | ||
Cat = 1, | ||
Dog = 2 | ||
} | ||
enum Animals { | ||
CatDog = Cat - Dog | ||
} |
9 changes: 9 additions & 0 deletions
9
...el-plugin-transform-typescript/test/fixtures/enum/enum-merging-inner-references/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,9 @@ | ||
var Animals = /*#__PURE__*/function (Animals) { | ||
Animals[Animals["Cat"] = 1] = "Cat"; | ||
Animals[Animals["Dog"] = 2] = "Dog"; | ||
return Animals; | ||
}(Animals || {}); | ||
Animals = /*#__PURE__*/function (Animals) { | ||
Animals[Animals["CatDog"] = -1] = "CatDog"; | ||
return Animals; | ||
}(Animals || {}); |