Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix optional-chaining with TS non-null operator (#10961)
- Loading branch information
Showing
10 changed files
with
69 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
8 changes: 8 additions & 0 deletions
8
...sal-optional-chaining/test/fixtures/regression/10959-transform-optional-chaining/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,8 @@ | ||
a?.b!.c; | ||
a?.b!.c.d; | ||
a?.b.c!.d; | ||
a!.b?.c; | ||
a?.b!?.c; | ||
a?.b!.c?.c; | ||
(a?.b!).c; | ||
(a?.b)!.c; |
6 changes: 6 additions & 0 deletions
6
...optional-chaining/test/fixtures/regression/10959-transform-optional-chaining/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,6 @@ | ||
{ | ||
"plugins": [ | ||
"proposal-optional-chaining", | ||
"syntax-typescript" | ||
] | ||
} |
10 changes: 10 additions & 0 deletions
10
...al-optional-chaining/test/fixtures/regression/10959-transform-optional-chaining/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,10 @@ | ||
var _a, _a2, _a3, _b, _a4, _ref, _a5, _c, _a6, _a7; | ||
|
||
(_a = a) === null || _a === void 0 ? void 0 : _a.b!.c; | ||
(_a2 = a) === null || _a2 === void 0 ? void 0 : _a2.b!.c.d; | ||
(_a3 = a) === null || _a3 === void 0 ? void 0 : _a3.b.c!.d; | ||
(_b = a!.b) === null || _b === void 0 ? void 0 : _b.c; | ||
(_a4 = a) === null || _a4 === void 0 ? void 0 : (_ref = _a4.b!) === null || _ref === void 0 ? void 0 : _ref.c; | ||
(_a5 = a) === null || _a5 === void 0 ? void 0 : (_c = _a5.b!.c) === null || _c === void 0 ? void 0 : _c.c; | ||
((_a6 = a) === null || _a6 === void 0 ? void 0 : _a6.b)!.c; | ||
((_a7 = a) === null || _a7 === void 0 ? void 0 : _a7.b)!.c; |
8 changes: 8 additions & 0 deletions
8
...ional-chaining/test/fixtures/regression/10959-transform-ts-and-optional-chaining/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,8 @@ | ||
a?.b!.c; | ||
a?.b!.c.d; | ||
a?.b.c!.d; | ||
a!.b?.c; | ||
a?.b!?.c; | ||
a?.b!.c?.c; | ||
(a?.b!).c; | ||
(a?.b)!.c; |
3 changes: 3 additions & 0 deletions
3
...l-chaining/test/fixtures/regression/10959-transform-ts-and-optional-chaining/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": ["proposal-optional-chaining", "transform-typescript"] | ||
} |
10 changes: 10 additions & 0 deletions
10
...onal-chaining/test/fixtures/regression/10959-transform-ts-and-optional-chaining/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,10 @@ | ||
var _a, _a2, _a3, _b, _a4, _ref, _a5, _c, _a6, _a7; | ||
|
||
(_a = a) === null || _a === void 0 ? void 0 : _a.b.c; | ||
(_a2 = a) === null || _a2 === void 0 ? void 0 : _a2.b.c.d; | ||
(_a3 = a) === null || _a3 === void 0 ? void 0 : _a3.b.c.d; | ||
(_b = a.b) === null || _b === void 0 ? void 0 : _b.c; | ||
(_a4 = a) === null || _a4 === void 0 ? void 0 : (_ref = _a4.b) === null || _ref === void 0 ? void 0 : _ref.c; | ||
(_a5 = a) === null || _a5 === void 0 ? void 0 : (_c = _a5.b.c) === null || _c === void 0 ? void 0 : _c.c; | ||
((_a6 = a) === null || _a6 === void 0 ? void 0 : _a6.b).c; | ||
((_a7 = a) === null || _a7 === void 0 ? void 0 : _a7.b).c; |
8 changes: 8 additions & 0 deletions
8
...el-plugin-proposal-optional-chaining/test/fixtures/regression/10959-transform-ts/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,8 @@ | ||
a?.b!.c; | ||
a?.b!.c.d; | ||
a?.b.c!.d; | ||
a!.b?.c; | ||
a?.b!?.c; | ||
a?.b!.c?.c; | ||
(a?.b!).c; | ||
(a?.b)!.c; |
3 changes: 3 additions & 0 deletions
3
...lugin-proposal-optional-chaining/test/fixtures/regression/10959-transform-ts/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"] | ||
} |
8 changes: 8 additions & 0 deletions
8
...l-plugin-proposal-optional-chaining/test/fixtures/regression/10959-transform-ts/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,8 @@ | ||
a?.b.c; | ||
a?.b.c.d; | ||
a?.b.c.d; | ||
a.b?.c; | ||
a?.b?.c; | ||
a?.b.c?.c; | ||
(a?.b).c; | ||
(a?.b).c; |