Fix compatibility between estree and TS plugin (#9700)
This commit is contained in:
4
packages/babel-parser/test/fixtures/estree/typescript/enum/input.js
vendored
Normal file
4
packages/babel-parser/test/fixtures/estree/typescript/enum/input.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
enum A {
|
||||
a,
|
||||
"r"
|
||||
}
|
||||
132
packages/babel-parser/test/fixtures/estree/typescript/enum/output.json
vendored
Normal file
132
packages/babel-parser/test/fixtures/estree/typescript/enum/output.json
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSEnumDeclaration",
|
||||
"start": 0,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 5,
|
||||
"end": 6,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"identifierName": "A"
|
||||
},
|
||||
"name": "A"
|
||||
},
|
||||
"members": [
|
||||
{
|
||||
"type": "TSEnumMember",
|
||||
"start": 11,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 3
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 11,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 3
|
||||
},
|
||||
"identifierName": "a"
|
||||
},
|
||||
"name": "a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TSEnumMember",
|
||||
"start": 16,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 5
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Literal",
|
||||
"start": 16,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 5
|
||||
}
|
||||
},
|
||||
"value": "r",
|
||||
"raw": "\"r\""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
1
packages/babel-parser/test/fixtures/estree/typescript/import-require/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/estree/typescript/import-require/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import x = require ("asdfasdf");
|
||||
3
packages/babel-parser/test/fixtures/estree/typescript/import-require/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/estree/typescript/import-require/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"sourceType": "module"
|
||||
}
|
||||
99
packages/babel-parser/test/fixtures/estree/typescript/import-require/output.json
vendored
Normal file
99
packages/babel-parser/test/fixtures/estree/typescript/import-require/output.json
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 32,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 32
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 32,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 32
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSImportEqualsDeclaration",
|
||||
"start": 0,
|
||||
"end": 32,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 32
|
||||
}
|
||||
},
|
||||
"isExport": false,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 7,
|
||||
"end": 8,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 8
|
||||
},
|
||||
"identifierName": "x"
|
||||
},
|
||||
"name": "x"
|
||||
},
|
||||
"moduleReference": {
|
||||
"type": "TSExternalModuleReference",
|
||||
"start": 11,
|
||||
"end": 31,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 31
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "Literal",
|
||||
"start": 20,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"value": "asdfasdf",
|
||||
"raw": "\"asdfasdf\""
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/estree/typescript/import/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/estree/typescript/import/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
let x: typeof import('./x');
|
||||
let Y: import('./y').Y;
|
||||
let z: import("/z").foo.bar<string>;
|
||||
441
packages/babel-parser/test/fixtures/estree/typescript/import/output.json
vendored
Normal file
441
packages/babel-parser/test/fixtures/estree/typescript/import/output.json
vendored
Normal file
@@ -0,0 +1,441 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 89,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 36
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 89,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 36
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 28
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 4,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
},
|
||||
"identifierName": "x"
|
||||
},
|
||||
"name": "x",
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start": 5,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeQuery",
|
||||
"start": 7,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"exprName": {
|
||||
"type": "TSImportType",
|
||||
"start": 14,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"argument": {
|
||||
"type": "Literal",
|
||||
"start": 21,
|
||||
"end": 26,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 21
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 26
|
||||
}
|
||||
},
|
||||
"value": "./x",
|
||||
"raw": "'./x'"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "let"
|
||||
},
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 29,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 23
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 33,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 33,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 22
|
||||
},
|
||||
"identifierName": "Y"
|
||||
},
|
||||
"name": "Y",
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start": 34,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TSImportType",
|
||||
"start": 36,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"argument": {
|
||||
"type": "Literal",
|
||||
"start": 43,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"value": "./y",
|
||||
"raw": "'./y'"
|
||||
},
|
||||
"qualifier": {
|
||||
"type": "Identifier",
|
||||
"start": 50,
|
||||
"end": 51,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 21
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 22
|
||||
},
|
||||
"identifierName": "Y"
|
||||
},
|
||||
"name": "Y"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "let"
|
||||
},
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 53,
|
||||
"end": 89,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 36
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 57,
|
||||
"end": 88,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 57,
|
||||
"end": 88,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 35
|
||||
},
|
||||
"identifierName": "z"
|
||||
},
|
||||
"name": "z",
|
||||
"typeAnnotation": {
|
||||
"type": "TSTypeAnnotation",
|
||||
"start": 58,
|
||||
"end": 88,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TSImportType",
|
||||
"start": 60,
|
||||
"end": 88,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"argument": {
|
||||
"type": "Literal",
|
||||
"start": 67,
|
||||
"end": 71,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"value": "/z",
|
||||
"raw": "\"/z\""
|
||||
},
|
||||
"qualifier": {
|
||||
"type": "TSQualifiedName",
|
||||
"start": 73,
|
||||
"end": 80,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start": 73,
|
||||
"end": 76,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 23
|
||||
},
|
||||
"identifierName": "foo"
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"right": {
|
||||
"type": "Identifier",
|
||||
"start": 77,
|
||||
"end": 80,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 24
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 27
|
||||
},
|
||||
"identifierName": "bar"
|
||||
},
|
||||
"name": "bar"
|
||||
}
|
||||
},
|
||||
"typeParameters": {
|
||||
"type": "TSTypeParameterInstantiation",
|
||||
"start": 80,
|
||||
"end": 88,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 27
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 35
|
||||
}
|
||||
},
|
||||
"params": [
|
||||
{
|
||||
"type": "TSStringKeyword",
|
||||
"start": 81,
|
||||
"end": 87,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 28
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 34
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "let"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
7
packages/babel-parser/test/fixtures/estree/typescript/literals/input.js
vendored
Normal file
7
packages/babel-parser/test/fixtures/estree/typescript/literals/input.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
type Foo = false;
|
||||
type Foo2 = true;
|
||||
type Foo3 = "string";
|
||||
type Foo4 = 123;
|
||||
type Foo4 = 123.4;
|
||||
type Foo5 = -123;
|
||||
type Foo5 = -123.5;
|
||||
516
packages/babel-parser/test/fixtures/estree/typescript/literals/output.json
vendored
Normal file
516
packages/babel-parser/test/fixtures/estree/typescript/literals/output.json
vendored
Normal file
@@ -0,0 +1,516 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 131,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 131,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "TSTypeAliasDeclaration",
|
||||
"start": 0,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 5,
|
||||
"end": 8,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 8
|
||||
},
|
||||
"identifierName": "Foo"
|
||||
},
|
||||
"name": "Foo"
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TSLiteralType",
|
||||
"start": 11,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"literal": {
|
||||
"type": "Literal",
|
||||
"start": 11,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"value": false,
|
||||
"raw": "false"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TSTypeAliasDeclaration",
|
||||
"start": 18,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 17
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 23,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 9
|
||||
},
|
||||
"identifierName": "Foo2"
|
||||
},
|
||||
"name": "Foo2"
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TSLiteralType",
|
||||
"start": 30,
|
||||
"end": 34,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"literal": {
|
||||
"type": "Literal",
|
||||
"start": 30,
|
||||
"end": 34,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"value": true,
|
||||
"raw": "true"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TSTypeAliasDeclaration",
|
||||
"start": 36,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 21
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 41,
|
||||
"end": 45,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 9
|
||||
},
|
||||
"identifierName": "Foo3"
|
||||
},
|
||||
"name": "Foo3"
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TSLiteralType",
|
||||
"start": 48,
|
||||
"end": 56,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 20
|
||||
}
|
||||
},
|
||||
"literal": {
|
||||
"type": "Literal",
|
||||
"start": 48,
|
||||
"end": 56,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 20
|
||||
}
|
||||
},
|
||||
"value": "string",
|
||||
"raw": "\"string\""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TSTypeAliasDeclaration",
|
||||
"start": 58,
|
||||
"end": 74,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 63,
|
||||
"end": 67,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 9
|
||||
},
|
||||
"identifierName": "Foo4"
|
||||
},
|
||||
"name": "Foo4"
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TSLiteralType",
|
||||
"start": 70,
|
||||
"end": 73,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"literal": {
|
||||
"type": "Literal",
|
||||
"start": 70,
|
||||
"end": 73,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"value": 123,
|
||||
"raw": "123"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TSTypeAliasDeclaration",
|
||||
"start": 75,
|
||||
"end": 93,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 80,
|
||||
"end": 84,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 9
|
||||
},
|
||||
"identifierName": "Foo4"
|
||||
},
|
||||
"name": "Foo4"
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TSLiteralType",
|
||||
"start": 87,
|
||||
"end": 92,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 17
|
||||
}
|
||||
},
|
||||
"literal": {
|
||||
"type": "Literal",
|
||||
"start": 87,
|
||||
"end": 92,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 17
|
||||
}
|
||||
},
|
||||
"value": 123.4,
|
||||
"raw": "123.4"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TSTypeAliasDeclaration",
|
||||
"start": 94,
|
||||
"end": 111,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 17
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 99,
|
||||
"end": 103,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 9
|
||||
},
|
||||
"identifierName": "Foo5"
|
||||
},
|
||||
"name": "Foo5"
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TSLiteralType",
|
||||
"start": 106,
|
||||
"end": 110,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"literal": {
|
||||
"type": "UnaryExpression",
|
||||
"start": 106,
|
||||
"end": 110,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"operator": "-",
|
||||
"prefix": true,
|
||||
"argument": {
|
||||
"type": "Literal",
|
||||
"start": 107,
|
||||
"end": 110,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"value": 123,
|
||||
"raw": "123"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "TSTypeAliasDeclaration",
|
||||
"start": 112,
|
||||
"end": 131,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 117,
|
||||
"end": 121,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"column": 9
|
||||
},
|
||||
"identifierName": "Foo5"
|
||||
},
|
||||
"name": "Foo5"
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "TSLiteralType",
|
||||
"start": 124,
|
||||
"end": 130,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"literal": {
|
||||
"type": "UnaryExpression",
|
||||
"start": 124,
|
||||
"end": 130,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"operator": "-",
|
||||
"prefix": true,
|
||||
"argument": {
|
||||
"type": "Literal",
|
||||
"start": 125,
|
||||
"end": 130,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"value": 123.5,
|
||||
"raw": "123.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/estree/typescript/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/estree/typescript/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["typescript", "estree"]
|
||||
}
|
||||
@@ -103,7 +103,7 @@
|
||||
}
|
||||
},
|
||||
"literal": {
|
||||
"type": "NumericLiteral",
|
||||
"type": "UnaryExpression",
|
||||
"start": 7,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
@@ -116,11 +116,28 @@
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": -1,
|
||||
"raw": "-1"
|
||||
},
|
||||
"value": -1
|
||||
"operator": "-",
|
||||
"prefix": true,
|
||||
"argument": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 8,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user