Treat import type * as a parser error (#7061)

This commit is contained in:
Brian Ng
2017-12-19 09:54:20 -06:00
committed by Henry Zhu
parent 68476b6ddd
commit 2b065350b5
25 changed files with 591 additions and 1068 deletions

View File

@@ -98,7 +98,7 @@ import type { foo, bar } from "baz";
import type { foo as bar } from "baz";
import type from "foo";
import type, { foo } from "bar";
import type * as namespace from "bar";
import typeof * as namespace from "bar";
import { type Foo } from "bar";
import { typeof Foo } from "bar";
import { type Foo as Bar } from "bar";

View File

@@ -221,7 +221,7 @@ import type { foo, bar } from "baz";
import type { foo as bar } from "baz";
import type from "foo";
import type, { foo } from "bar";
import type * as namespace from "bar";
import typeof * as namespace from "bar";
import { type Foo } from "bar";
import { typeof Foo } from "bar";
import { type Foo as Bar } from "bar";

View File

@@ -95,7 +95,7 @@ import type { foo2, bar } from "baz";
import type { foo as bar2 } from "baz";
import type from "foo";
import type2, { foo3 } from "bar";
import type * as namespace from "bar";
import typeof * as namespace from "bar";
export type { foo };
export type { foo2 } from "bar";
import {type T} from "foo";

View File

@@ -1926,6 +1926,12 @@ export default (superClass: Class<Parser>): Class<Parser> =>
}
if (kind) {
const lh = this.lookahead();
// import type * is not allowed
if (kind === "type" && lh.type === tt.star) {
this.unexpected(lh.start);
}
if (
isMaybeDefaultImport(lh) ||
lh.type === tt.braceL ||

View File

@@ -1 +0,0 @@
import type foo from "bar";

View File

@@ -1,104 +0,0 @@
{
"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",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 27
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 12,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 15
}
},
"local": {
"type": "Identifier",
"start": 12,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "foo"
},
"name": "foo"
}
}
],
"importKind": "type",
"source": {
"type": "StringLiteral",
"start": 21,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 26
}
},
"extra": {
"rawValue": "bar",
"raw": "\"bar\""
},
"value": "bar"
}
}
],
"directives": []
}
}

View File

@@ -1 +0,0 @@
import typeof foo from "bar";

View File

@@ -1,104 +0,0 @@
{
"type": "File",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"program": {
"type": "Program",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 29
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
}
},
"local": {
"type": "Identifier",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
},
"identifierName": "foo"
},
"name": "foo"
}
}
],
"importKind": "typeof",
"source": {
"type": "StringLiteral",
"start": 23,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 28
}
},
"extra": {
"rawValue": "bar",
"raw": "\"bar\""
},
"value": "bar"
}
}
],
"directives": []
}
}

View File

@@ -1 +0,0 @@
import type {foo, bar} from "baz";

View File

@@ -1,172 +0,0 @@
{
"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",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 34
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 13,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 16
}
},
"imported": {
"type": "Identifier",
"start": 13,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "foo"
},
"name": "foo"
},
"importKind": null,
"local": {
"type": "Identifier",
"start": 13,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "foo"
},
"name": "foo"
}
},
{
"type": "ImportSpecifier",
"start": 18,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 21
}
},
"imported": {
"type": "Identifier",
"start": 18,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 21
},
"identifierName": "bar"
},
"name": "bar"
},
"importKind": null,
"local": {
"type": "Identifier",
"start": 18,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 21
},
"identifierName": "bar"
},
"name": "bar"
}
}
],
"importKind": "type",
"source": {
"type": "StringLiteral",
"start": 28,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 28
},
"end": {
"line": 1,
"column": 33
}
},
"extra": {
"rawValue": "baz",
"raw": "\"baz\""
},
"value": "baz"
}
}
],
"directives": []
}
}

View File

@@ -1 +0,0 @@
import typeof {foo as bar} from "baz";

View File

@@ -1,122 +0,0 @@
{
"type": "File",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"program": {
"type": "Program",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 15,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 25
}
},
"imported": {
"type": "Identifier",
"start": 15,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 18
},
"identifierName": "foo"
},
"name": "foo"
},
"importKind": null,
"local": {
"type": "Identifier",
"start": 22,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 25
},
"identifierName": "bar"
},
"name": "bar"
}
}
],
"importKind": "typeof",
"source": {
"type": "StringLiteral",
"start": 32,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 32
},
"end": {
"line": 1,
"column": 37
}
},
"extra": {
"rawValue": "baz",
"raw": "\"baz\""
},
"value": "baz"
}
}
],
"directives": []
}
}

View File

@@ -1 +0,0 @@
import type from "foo";

View File

@@ -1,104 +0,0 @@
{
"type": "File",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"program": {
"type": "Program",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 11
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 11
},
"identifierName": "type"
},
"name": "type"
}
}
],
"importKind": "value",
"source": {
"type": "StringLiteral",
"start": 17,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 22
}
},
"extra": {
"rawValue": "foo",
"raw": "\"foo\""
},
"value": "foo"
}
}
],
"directives": []
}
}

View File

@@ -1 +0,0 @@
import type, {foo} from "bar";

View File

@@ -1,154 +0,0 @@
{
"type": "File",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 30
}
},
"program": {
"type": "Program",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 30
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 30
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 11
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 11
},
"identifierName": "type"
},
"name": "type"
}
},
{
"type": "ImportSpecifier",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
}
},
"imported": {
"type": "Identifier",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
},
"identifierName": "foo"
},
"name": "foo"
},
"importKind": null,
"local": {
"type": "Identifier",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 17
},
"identifierName": "foo"
},
"name": "foo"
}
}
],
"importKind": "value",
"source": {
"type": "StringLiteral",
"start": 24,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 29
}
},
"extra": {
"rawValue": "bar",
"raw": "\"bar\""
},
"value": "bar"
}
}
],
"directives": []
}
}

View File

@@ -1 +0,0 @@
import type * as namespace from "bar";

View File

@@ -1,104 +0,0 @@
{
"type": "File",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"program": {
"type": "Program",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 38
}
},
"specifiers": [
{
"type": "ImportNamespaceSpecifier",
"start": 12,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 26
}
},
"local": {
"type": "Identifier",
"start": 17,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 26
},
"identifierName": "namespace"
},
"name": "namespace"
}
}
],
"importKind": "type",
"source": {
"type": "StringLiteral",
"start": 32,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 32
},
"end": {
"line": 1,
"column": 37
}
},
"extra": {
"rawValue": "bar",
"raw": "\"bar\""
},
"value": "bar"
}
}
],
"directives": []
}
}

View File

@@ -1 +0,0 @@
import typeof * as namespace from "bar";

View File

@@ -1,104 +0,0 @@
{
"type": "File",
"start": 0,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 40
}
},
"program": {
"type": "Program",
"start": 0,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 40
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 40
}
},
"specifiers": [
{
"type": "ImportNamespaceSpecifier",
"start": 14,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 28
}
},
"local": {
"type": "Identifier",
"start": 19,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 28
},
"identifierName": "namespace"
},
"name": "namespace"
}
}
],
"importKind": "typeof",
"source": {
"type": "StringLiteral",
"start": 34,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 34
},
"end": {
"line": 1,
"column": 39
}
},
"extra": {
"rawValue": "bar",
"raw": "\"bar\""
},
"value": "bar"
}
}
],
"directives": []
}
}

View File

@@ -3,7 +3,12 @@ import type {named} from "foo";
import type Def, {named} from "foo";
import type switch from "foo";
import type { switch } from "foo";
import type { foo, bar } from "baz";
import type from "foo";
import type, { foo } from "bar";
import typeof foo from "bar";
import typeof switch from "foo";
import typeof { switch } from "foo";
import type * as ns from "foo";
import type * as switch from "foo";
import typeof { foo as bar } from "baz";
import typeof * as ns from "foo";
import typeof * as switch from "foo";

View File

@@ -1,29 +1,29 @@
{
"type": "File",
"start": 0,
"end": 300,
"end": 469,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 9,
"column": 35
"line": 14,
"column": 37
}
},
"program": {
"type": "Program",
"start": 0,
"end": 300,
"end": 469,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 9,
"column": 35
"line": 14,
"column": 37
}
},
"sourceType": "module",
@@ -467,7 +467,7 @@
{
"type": "ImportDeclaration",
"start": 163,
"end": 195,
"end": 199,
"loc": {
"start": {
"line": 6,
@@ -475,14 +475,14 @@
},
"end": {
"line": 6,
"column": 32
"column": 36
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"type": "ImportSpecifier",
"start": 177,
"end": 183,
"end": 180,
"loc": {
"start": {
"line": 6,
@@ -490,13 +490,13 @@
},
"end": {
"line": 6,
"column": 20
"column": 17
}
},
"local": {
"imported": {
"type": "Identifier",
"start": 177,
"end": 183,
"end": 180,
"loc": {
"start": {
"line": 6,
@@ -504,6 +504,404 @@
},
"end": {
"line": 6,
"column": 17
},
"identifierName": "foo"
},
"name": "foo"
},
"importKind": null,
"local": {
"type": "Identifier",
"start": 177,
"end": 180,
"loc": {
"start": {
"line": 6,
"column": 14
},
"end": {
"line": 6,
"column": 17
},
"identifierName": "foo"
},
"name": "foo"
}
},
{
"type": "ImportSpecifier",
"start": 182,
"end": 185,
"loc": {
"start": {
"line": 6,
"column": 19
},
"end": {
"line": 6,
"column": 22
}
},
"imported": {
"type": "Identifier",
"start": 182,
"end": 185,
"loc": {
"start": {
"line": 6,
"column": 19
},
"end": {
"line": 6,
"column": 22
},
"identifierName": "bar"
},
"name": "bar"
},
"importKind": null,
"local": {
"type": "Identifier",
"start": 182,
"end": 185,
"loc": {
"start": {
"line": 6,
"column": 19
},
"end": {
"line": 6,
"column": 22
},
"identifierName": "bar"
},
"name": "bar"
}
}
],
"importKind": "type",
"source": {
"type": "StringLiteral",
"start": 193,
"end": 198,
"loc": {
"start": {
"line": 6,
"column": 30
},
"end": {
"line": 6,
"column": 35
}
},
"extra": {
"rawValue": "baz",
"raw": "\"baz\""
},
"value": "baz"
}
},
{
"type": "ImportDeclaration",
"start": 200,
"end": 223,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 7,
"column": 23
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 207,
"end": 211,
"loc": {
"start": {
"line": 7,
"column": 7
},
"end": {
"line": 7,
"column": 11
}
},
"local": {
"type": "Identifier",
"start": 207,
"end": 211,
"loc": {
"start": {
"line": 7,
"column": 7
},
"end": {
"line": 7,
"column": 11
},
"identifierName": "type"
},
"name": "type"
}
}
],
"importKind": "value",
"source": {
"type": "StringLiteral",
"start": 217,
"end": 222,
"loc": {
"start": {
"line": 7,
"column": 17
},
"end": {
"line": 7,
"column": 22
}
},
"extra": {
"rawValue": "foo",
"raw": "\"foo\""
},
"value": "foo"
}
},
{
"type": "ImportDeclaration",
"start": 224,
"end": 256,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 32
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 231,
"end": 235,
"loc": {
"start": {
"line": 8,
"column": 7
},
"end": {
"line": 8,
"column": 11
}
},
"local": {
"type": "Identifier",
"start": 231,
"end": 235,
"loc": {
"start": {
"line": 8,
"column": 7
},
"end": {
"line": 8,
"column": 11
},
"identifierName": "type"
},
"name": "type"
}
},
{
"type": "ImportSpecifier",
"start": 239,
"end": 242,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 8,
"column": 18
}
},
"imported": {
"type": "Identifier",
"start": 239,
"end": 242,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 8,
"column": 18
},
"identifierName": "foo"
},
"name": "foo"
},
"importKind": null,
"local": {
"type": "Identifier",
"start": 239,
"end": 242,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 8,
"column": 18
},
"identifierName": "foo"
},
"name": "foo"
}
}
],
"importKind": "value",
"source": {
"type": "StringLiteral",
"start": 250,
"end": 255,
"loc": {
"start": {
"line": 8,
"column": 26
},
"end": {
"line": 8,
"column": 31
}
},
"extra": {
"rawValue": "bar",
"raw": "\"bar\""
},
"value": "bar"
}
},
{
"type": "ImportDeclaration",
"start": 257,
"end": 286,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 9,
"column": 29
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 271,
"end": 274,
"loc": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 9,
"column": 17
}
},
"local": {
"type": "Identifier",
"start": 271,
"end": 274,
"loc": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 9,
"column": 17
},
"identifierName": "foo"
},
"name": "foo"
}
}
],
"importKind": "typeof",
"source": {
"type": "StringLiteral",
"start": 280,
"end": 285,
"loc": {
"start": {
"line": 9,
"column": 23
},
"end": {
"line": 9,
"column": 28
}
},
"extra": {
"rawValue": "bar",
"raw": "\"bar\""
},
"value": "bar"
}
},
{
"type": "ImportDeclaration",
"start": 287,
"end": 319,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 10,
"column": 32
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 301,
"end": 307,
"loc": {
"start": {
"line": 10,
"column": 14
},
"end": {
"line": 10,
"column": 20
}
},
"local": {
"type": "Identifier",
"start": 301,
"end": 307,
"loc": {
"start": {
"line": 10,
"column": 14
},
"end": {
"line": 10,
"column": 20
},
"identifierName": "switch"
@@ -515,15 +913,15 @@
"importKind": "typeof",
"source": {
"type": "StringLiteral",
"start": 189,
"end": 194,
"start": 313,
"end": 318,
"loc": {
"start": {
"line": 6,
"line": 10,
"column": 26
},
"end": {
"line": 6,
"line": 10,
"column": 31
}
},
@@ -536,44 +934,44 @@
},
{
"type": "ImportDeclaration",
"start": 196,
"end": 232,
"start": 320,
"end": 356,
"loc": {
"start": {
"line": 7,
"line": 11,
"column": 0
},
"end": {
"line": 7,
"line": 11,
"column": 36
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 212,
"end": 218,
"start": 336,
"end": 342,
"loc": {
"start": {
"line": 7,
"line": 11,
"column": 16
},
"end": {
"line": 7,
"line": 11,
"column": 22
}
},
"imported": {
"type": "Identifier",
"start": 212,
"end": 218,
"start": 336,
"end": 342,
"loc": {
"start": {
"line": 7,
"line": 11,
"column": 16
},
"end": {
"line": 7,
"line": 11,
"column": 22
},
"identifierName": "switch"
@@ -583,15 +981,15 @@
"importKind": null,
"local": {
"type": "Identifier",
"start": 212,
"end": 218,
"start": 336,
"end": 342,
"loc": {
"start": {
"line": 7,
"line": 11,
"column": 16
},
"end": {
"line": 7,
"line": 11,
"column": 22
},
"identifierName": "switch"
@@ -603,15 +1001,15 @@
"importKind": "typeof",
"source": {
"type": "StringLiteral",
"start": 226,
"end": 231,
"start": 350,
"end": 355,
"loc": {
"start": {
"line": 7,
"line": 11,
"column": 30
},
"end": {
"line": 7,
"line": 11,
"column": 35
}
},
@@ -624,45 +1022,133 @@
},
{
"type": "ImportDeclaration",
"start": 233,
"end": 264,
"start": 357,
"end": 397,
"loc": {
"start": {
"line": 8,
"line": 12,
"column": 0
},
"end": {
"line": 8,
"column": 31
"line": 12,
"column": 40
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 373,
"end": 383,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 26
}
},
"imported": {
"type": "Identifier",
"start": 373,
"end": 376,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 19
},
"identifierName": "foo"
},
"name": "foo"
},
"importKind": null,
"local": {
"type": "Identifier",
"start": 380,
"end": 383,
"loc": {
"start": {
"line": 12,
"column": 23
},
"end": {
"line": 12,
"column": 26
},
"identifierName": "bar"
},
"name": "bar"
}
}
],
"importKind": "typeof",
"source": {
"type": "StringLiteral",
"start": 391,
"end": 396,
"loc": {
"start": {
"line": 12,
"column": 34
},
"end": {
"line": 12,
"column": 39
}
},
"extra": {
"rawValue": "baz",
"raw": "\"baz\""
},
"value": "baz"
}
},
{
"type": "ImportDeclaration",
"start": 398,
"end": 431,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 13,
"column": 33
}
},
"specifiers": [
{
"type": "ImportNamespaceSpecifier",
"start": 245,
"end": 252,
"start": 412,
"end": 419,
"loc": {
"start": {
"line": 8,
"column": 12
"line": 13,
"column": 14
},
"end": {
"line": 8,
"column": 19
"line": 13,
"column": 21
}
},
"local": {
"type": "Identifier",
"start": 250,
"end": 252,
"start": 417,
"end": 419,
"loc": {
"start": {
"line": 8,
"column": 17
"line": 13,
"column": 19
},
"end": {
"line": 8,
"column": 19
"line": 13,
"column": 21
},
"identifierName": "ns"
},
@@ -670,19 +1156,19 @@
}
}
],
"importKind": "type",
"importKind": "typeof",
"source": {
"type": "StringLiteral",
"start": 258,
"end": 263,
"start": 425,
"end": 430,
"loc": {
"start": {
"line": 8,
"column": 25
"line": 13,
"column": 27
},
"end": {
"line": 8,
"column": 30
"line": 13,
"column": 32
}
},
"extra": {
@@ -694,45 +1180,45 @@
},
{
"type": "ImportDeclaration",
"start": 265,
"end": 300,
"start": 432,
"end": 469,
"loc": {
"start": {
"line": 9,
"line": 14,
"column": 0
},
"end": {
"line": 9,
"column": 35
"line": 14,
"column": 37
}
},
"specifiers": [
{
"type": "ImportNamespaceSpecifier",
"start": 277,
"end": 288,
"start": 446,
"end": 457,
"loc": {
"start": {
"line": 9,
"column": 12
"line": 14,
"column": 14
},
"end": {
"line": 9,
"column": 23
"line": 14,
"column": 25
}
},
"local": {
"type": "Identifier",
"start": 282,
"end": 288,
"start": 451,
"end": 457,
"loc": {
"start": {
"line": 9,
"column": 17
"line": 14,
"column": 19
},
"end": {
"line": 9,
"column": 23
"line": 14,
"column": 25
},
"identifierName": "switch"
},
@@ -740,19 +1226,19 @@
}
}
],
"importKind": "type",
"importKind": "typeof",
"source": {
"type": "StringLiteral",
"start": 294,
"end": 299,
"start": 463,
"end": 468,
"loc": {
"start": {
"line": 9,
"column": 29
"line": 14,
"column": 31
},
"end": {
"line": 9,
"column": 34
"line": 14,
"column": 36
}
},
"extra": {

View File

@@ -0,0 +1 @@
import type * as namespace from "bar";

View File

@@ -0,0 +1,3 @@
{
"throws": "Unexpected token (1:12)"
}