[ts] Make ImportDeclaration always have importKind (#12170)
This commit is contained in:
parent
ff6c3792bb
commit
963537d5f5
@ -2007,11 +2007,13 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
) {
|
||||
node.importKind = "type";
|
||||
this.next();
|
||||
} else {
|
||||
node.importKind = "value";
|
||||
}
|
||||
}
|
||||
|
||||
if (!node.importKind) {
|
||||
node.importKind = "value";
|
||||
}
|
||||
|
||||
const importNode = super.parseImport(node);
|
||||
/*:: invariant(importNode.type !== "TSImportEqualsDeclaration") */
|
||||
|
||||
|
||||
1
packages/babel-parser/test/fixtures/typescript/import/import-side-effects/input.ts
vendored
Normal file
1
packages/babel-parser/test/fixtures/typescript/import/import-side-effects/input.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
import "foo";
|
||||
28
packages/babel-parser/test/fixtures/typescript/import/import-side-effects/output.json
vendored
Normal file
28
packages/babel-parser/test/fixtures/typescript/import/import-side-effects/output.json
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ImportDeclaration",
|
||||
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||
"importKind": "value",
|
||||
"specifiers": [],
|
||||
"source": {
|
||||
"type": "StringLiteral",
|
||||
"start":7,"end":12,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":12}},
|
||||
"extra": {
|
||||
"rawValue": "foo",
|
||||
"raw": "\"foo\""
|
||||
},
|
||||
"value": "foo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user