Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Correctly generate
(a ?? b) as T
(#15258)
* fix * update tests * revert
- Loading branch information
1 parent
b0878e0
commit 67cb9f1
Showing
4 changed files
with
17 additions
and
5 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
3 changes: 3 additions & 0 deletions
3
packages/babel-generator/test/fixtures/typescript/cast-need-parentheses/input.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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
(<T> x).y; | ||
(x as T).y; | ||
x!.y; | ||
|
||
(point1 ?? point2 as Point); | ||
(point1 ?? point2) as Point; |
4 changes: 3 additions & 1 deletion
4
packages/babel-generator/test/fixtures/typescript/cast-need-parentheses/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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
(<T> x).y; | ||
(x as T).y; | ||
x!.y; | ||
x!.y; | ||
point1 ?? (point2 as Point); | ||
((point1 ?? point2) as Point); |
2 changes: 1 addition & 1 deletion
2
...-optional-chaining/test/fixtures/transparent-expr-wrappers/ts-as-in-conditional/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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
a => { | ||
var _a$c; | ||
((a !== null && a !== void 0 && a.b as any) && (_a$c = a.c) !== null && _a$c !== void 0 && _a$c.d as any) ? 0 : 1; | ||
((((a !== null && a !== void 0 && a.b) as any) && (_a$c = a.c) !== null && _a$c !== void 0 && _a$c.d) as any) ? 0 : 1; | ||
}; |