-
-
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.
Parse type imports in TSImportEqualsDeclaration (#12962)
- Loading branch information
Showing
22 changed files
with
413 additions
and
11 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
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
1 change: 1 addition & 0 deletions
1
...es/babel-parser/test/fixtures/typescript/import/export-import-type-as-identifier/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 @@ | ||
export import type = require("A"); |
37 changes: 37 additions & 0 deletions
37
...babel-parser/test/fixtures/typescript/import/export-import-type-as-identifier/output.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,37 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "TSImportEqualsDeclaration", | ||
"start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, | ||
"importKind": "value", | ||
"isExport": true, | ||
"id": { | ||
"type": "Identifier", | ||
"start":14,"end":18,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":18},"identifierName":"type"}, | ||
"name": "type" | ||
}, | ||
"moduleReference": { | ||
"type": "TSExternalModuleReference", | ||
"start":21,"end":33,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":33}}, | ||
"expression": { | ||
"type": "StringLiteral", | ||
"start":29,"end":32,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":32}}, | ||
"extra": { | ||
"rawValue": "A", | ||
"raw": "\"A\"" | ||
}, | ||
"value": "A" | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/typescript/import/export-import-type-require/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 @@ | ||
export import type a = require("a"); |
37 changes: 37 additions & 0 deletions
37
packages/babel-parser/test/fixtures/typescript/import/export-import-type-require/output.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,37 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "TSImportEqualsDeclaration", | ||
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}}, | ||
"importKind": "type", | ||
"isExport": true, | ||
"id": { | ||
"type": "Identifier", | ||
"start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"a"}, | ||
"name": "a" | ||
}, | ||
"moduleReference": { | ||
"type": "TSExternalModuleReference", | ||
"start":23,"end":35,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":35}}, | ||
"expression": { | ||
"type": "StringLiteral", | ||
"start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, | ||
"extra": { | ||
"rawValue": "a", | ||
"raw": "\"a\"" | ||
}, | ||
"value": "a" | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/typescript/import/export-import-type/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 @@ | ||
export import type A = B.C; |
41 changes: 41 additions & 0 deletions
41
packages/babel-parser/test/fixtures/typescript/import/export-import-type/output.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,41 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, | ||
"errors": [ | ||
"SyntaxError: An import alias can not use 'import type' (1:23)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "TSImportEqualsDeclaration", | ||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, | ||
"importKind": "type", | ||
"isExport": true, | ||
"id": { | ||
"type": "Identifier", | ||
"start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"A"}, | ||
"name": "A" | ||
}, | ||
"moduleReference": { | ||
"type": "TSQualifiedName", | ||
"start":23,"end":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, | ||
"left": { | ||
"type": "Identifier", | ||
"start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"B"}, | ||
"name": "B" | ||
}, | ||
"right": { | ||
"type": "Identifier", | ||
"start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26},"identifierName":"C"}, | ||
"name": "C" | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
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
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/typescript/import/import-type-as-identifier/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 @@ | ||
import type = require("A"); |
37 changes: 37 additions & 0 deletions
37
packages/babel-parser/test/fixtures/typescript/import/import-type-as-identifier/output.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,37 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "TSImportEqualsDeclaration", | ||
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, | ||
"importKind": "value", | ||
"isExport": false, | ||
"id": { | ||
"type": "Identifier", | ||
"start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11},"identifierName":"type"}, | ||
"name": "type" | ||
}, | ||
"moduleReference": { | ||
"type": "TSExternalModuleReference", | ||
"start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, | ||
"expression": { | ||
"type": "StringLiteral", | ||
"start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}}, | ||
"extra": { | ||
"rawValue": "A", | ||
"raw": "\"A\"" | ||
}, | ||
"value": "A" | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/babel-parser/test/fixtures/typescript/import/type-asi/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,15 @@ | ||
import type | ||
A = require("A"); | ||
|
||
import | ||
type | ||
a = require("a"); | ||
|
||
export import | ||
type | ||
B = require("B"); | ||
|
||
export | ||
import | ||
type | ||
b = require("b"); |
Oops, something went wrong.