Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
TypeAnnotation
with comments generates incorrect code (#14762)
* fix * review
- Loading branch information
1 parent
a33ad27
commit 770c22f
Showing
12 changed files
with
90 additions
and
32 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
2 changes: 2 additions & 0 deletions
2
.../types-arrow-return-with-comment/input.js → .../fixtures/flow/type-with-comment/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 +1,3 @@ | ||
export default (): void /* hi! */ => {}; | ||
|
||
const foo: any /* Hi! */[] = []; |
2 changes: 2 additions & 0 deletions
2
packages/babel-generator/test/fixtures/flow/type-with-comment/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,2 @@ | ||
export default ((): void /* hi! */ => {}); | ||
const foo: any /* Hi! */[] = []; |
3 changes: 3 additions & 0 deletions
3
packages/babel-generator/test/fixtures/typescript/type-with-comment/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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default (): void /* hi! */ => {}; | ||
|
||
const foo: any /* Hi! */[] = []; |
2 changes: 2 additions & 0 deletions
2
packages/babel-generator/test/fixtures/typescript/type-with-comment/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,2 @@ | ||
export default ((): void /* hi! */ => {}); | ||
const foo: any /* Hi! */[] = []; |
1 change: 0 additions & 1 deletion
1
packages/babel-generator/test/fixtures/typescript/types-arrow-return-with-comment/output.js
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
packages/babel-generator/test/fixtures/typescript/types-with-comments-retainLines/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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
type T = U. | ||
/* 1 */ | ||
C /* 2 */ [ | ||
/* 3 */ | ||
0]; | ||
|
||
type T2 = U. | ||
/* 1 */ | ||
C /* 2 */ [ | ||
/* 3 */ | ||
]; | ||
|
||
type T3 = U. | ||
/* 1 */ | ||
C /* 2 */ < | ||
/* 3 */ | ||
0>; | ||
|
||
let f = (x) | ||
/* 1 */ | ||
: | ||
/* 2 */ | ||
void /* 3 */ => 1 |
3 changes: 3 additions & 0 deletions
3
...ges/babel-generator/test/fixtures/typescript/types-with-comments-retainLines/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 @@ | ||
{ | ||
"retainLines": true | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/babel-generator/test/fixtures/typescript/types-with-comments-retainLines/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,23 @@ | ||
type T = U. | ||
/* 1 */ | ||
C /* 2 */[ | ||
/* 3 */ | ||
0]; | ||
|
||
type T2 = U. | ||
/* 1 */ | ||
C /* 2 */[]; | ||
|
||
|
||
|
||
type T3 = U. | ||
/* 1 */ | ||
C /* 2 */< | ||
/* 3 */ | ||
0>; | ||
|
||
let f = (x) | ||
/* 1 */ | ||
: | ||
/* 2 */ | ||
void /* 3 */ => 1; |