diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index ac457ec0ca3..876c8b3b43b 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -39253,139 +39253,269 @@ Object { } `; -exports[`typescript fixtures/basics/function-overloads.src 1`] = ` +exports[`typescript fixtures/basics/function-anonymus-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "async": false, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "f", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "params": Array [ - Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 27, + "column": 7, "line": 1, }, "start": Object { - "column": 18, + "column": 4, "line": 1, }, }, - "name": "x", + "name": "obj", "range": Array [ - 18, - 27, + 4, + 7, ], "type": "Identifier", - "typeAnnotation": Object { + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 38, + 47, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 19, + "column": 34, "line": 1, }, }, "range": Array [ - 19, - 27, + 34, + 49, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 27, + "column": 32, "line": 1, }, "start": Object { - "column": 21, + "column": 23, "line": 1, }, }, + "name": "a", "range": Array [ - 21, - 27, + 23, + 32, ], - "type": "TSNumberKeyword", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 10, + 49, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "range": Array [ + 20, + 21, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 19, + 22, + ], + "type": "TSTypeParameterDeclaration", }, }, - ], - "range": Array [ - 7, - 37, - ], - "returnType": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 28, + "column": 4, "line": 1, }, }, "range": Array [ - 28, - 36, + 4, + 49, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "TSNumberKeyword", - }, + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, - "type": "TSDeclareFunction", }, + "range": Array [ + 0, + 50, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "module", + "tokens": Array [ + Object { "loc": Object { "end": Object { - "column": 37, + "column": 3, "line": 1, }, "start": Object { @@ -39395,514 +39525,133 @@ Object { }, "range": Array [ 0, - 37, + 3, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "Keyword", + "value": "var", }, Object { - "declaration": Object { - "async": false, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "f", - "range": Array [ - 54, - 55, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, + "start": Object { + "column": 4, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 56, - 65, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 57, - 65, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 59, - 65, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], - "range": Array [ - 45, - 75, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "range": Array [ - 66, - 74, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 68, - 74, - ], - "type": "TSStringKeyword", - }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, }, - "type": "TSDeclareFunction", }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 38, - 75, + 10, + 18, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "Keyword", + "value": "function", }, - Object { - "declaration": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "name": "x", - "range": Array [ - 142, - 143, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 135, - 144, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 55, - "line": 3, - }, - }, - "range": Array [ - 131, - 146, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "name": "f", - "range": Array [ - 92, - 93, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "name": "x", - "range": Array [ - 94, - 112, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 3, - }, - }, - "range": Array [ - 95, - 112, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 112, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 103, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "range": Array [ - 106, - 112, - ], - "type": "TSNumberKeyword", - }, - ], - }, - }, - }, - ], - "range": Array [ - 83, - 146, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 37, - "line": 3, - }, - }, - "range": Array [ - 113, - 130, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 39, - "line": 3, - }, - }, - "range": Array [ - 115, - 130, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 3, - }, - "start": Object { - "column": 39, - "line": 3, - }, - }, - "range": Array [ - 115, - 121, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 48, - "line": 3, - }, - }, - "range": Array [ - 124, - 130, - ], - "type": "TSNumberKeyword", - }, - ], - }, - }, - "type": "FunctionDeclaration", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 76, - 146, - ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 147, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 20, "line": 1, }, "start": Object { - "column": 0, + "column": 19, "line": 1, }, }, "range": Array [ - 0, - 6, + 19, + 20, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 21, "line": 1, }, "start": Object { - "column": 7, + "column": 20, "line": 1, }, }, "range": Array [ - 7, - 15, + 20, + 21, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 22, "line": 1, }, "start": Object { - "column": 16, + "column": 21, "line": 1, }, }, "range": Array [ - 16, - 17, + 21, + 22, ], - "type": "Identifier", - "value": "f", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 23, "line": 1, }, "start": Object { - "column": 17, + "column": 22, "line": 1, }, }, "range": Array [ - 17, - 18, + 22, + 23, ], "type": "Punctuator", "value": "(", @@ -39910,35 +39659,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 24, "line": 1, }, "start": Object { - "column": 18, + "column": 23, "line": 1, }, }, "range": Array [ - 18, - 19, + 23, + 24, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 25, "line": 1, }, "start": Object { - "column": 19, + "column": 24, "line": 1, }, }, "range": Array [ - 19, - 20, + 24, + 25, ], "type": "Punctuator", "value": ":", @@ -39946,35 +39695,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 32, "line": 1, }, "start": Object { - "column": 21, + "column": 26, "line": 1, }, }, "range": Array [ - 21, - 27, + 26, + 32, ], "type": "Identifier", - "value": "number", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 33, "line": 1, }, "start": Object { - "column": 27, + "column": 32, "line": 1, }, }, "range": Array [ - 27, - 28, + 32, + 33, ], "type": "Punctuator", "value": ")", @@ -39982,65 +39731,29 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, + "column": 35, "line": 1, }, "start": Object { - "column": 36, + "column": 34, "line": 1, }, }, "range": Array [ - 36, - 37, + 34, + 35, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 2, }, "start": Object { - "column": 0, + "column": 2, "line": 2, }, }, @@ -40049,364 +39762,339 @@ Object { 44, ], "type": "Keyword", - "value": "export", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 2, }, "start": Object { - "column": 7, + "column": 9, "line": 2, }, }, "range": Array [ 45, - 53, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 54, - 55, - ], - "type": "Identifier", - "value": "f", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 55, - 56, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 56, - 57, + 46, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 11, "line": 2, }, "start": Object { - "column": 19, + "column": 10, "line": 2, }, }, "range": Array [ - 57, - 58, + 46, + 47, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 59, - 65, - ], - "type": "Identifier", - "value": "string", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 27, - "line": 2, + "column": 0, + "line": 3, }, }, "range": Array [ - 65, - 66, + 48, + 49, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 2, + "line": 3, }, "start": Object { - "column": 28, - "line": 2, + "column": 1, + "line": 3, }, }, "range": Array [ - 66, - 67, + 49, + 50, ], "type": "Punctuator", - "value": ":", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-anynomus-with-return-type.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 31, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 68, - 74, ], - "type": "Identifier", - "value": "string", - }, - Object { + "kind": "var", "loc": Object { "end": Object { - "column": 37, + "column": 2, "line": 2, }, "start": Object { - "column": 36, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 74, - 75, + 0, + 32, ], - "type": "Punctuator", - "value": ";", + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 3, + "line": 1, }, "start": Object { "column": 0, - "line": 3, + "line": 1, }, }, "range": Array [ - 76, - 82, + 0, + 3, ], "type": "Keyword", - "value": "export", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { "column": 7, - "line": 3, - }, - }, - "range": Array [ - 83, - 91, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 4, + "line": 1, }, }, "range": Array [ - 92, - 93, + 4, + 7, ], "type": "Identifier", - "value": "f", + "value": "obj", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 9, + "line": 1, }, "start": Object { - "column": 17, - "line": 3, + "column": 8, + "line": 1, }, }, "range": Array [ - 93, - 94, + 8, + 9, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 10, + "line": 1, }, }, "range": Array [ - 94, - 95, + 10, + 18, ], - "type": "Identifier", - "value": "x", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { "column": 20, - "line": 3, + "line": 1, }, "start": Object { "column": 19, - "line": 3, + "line": 1, }, }, "range": Array [ - 95, - 96, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 103, - ], - "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 3, - }, - }, - "range": Array [ - 104, - 105, - ], - "type": "Punctuator", - "value": "|", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "range": Array [ - 106, - 112, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 3, + "line": 1, }, "start": Object { - "column": 36, - "line": 3, + "column": 20, + "line": 1, }, }, "range": Array [ - 112, - 113, + 20, + 21, ], "type": "Punctuator", "value": ")", @@ -40414,17 +40102,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 37, - "line": 3, + "column": 21, + "line": 1, }, }, "range": Array [ - 113, - 114, + 21, + 22, ], "type": "Punctuator", "value": ":", @@ -40432,215 +40120,1468 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, - "line": 3, + "column": 27, + "line": 1, }, "start": Object { - "column": 39, - "line": 3, + "column": 23, + "line": 1, }, }, "range": Array [ - 115, - 121, + 23, + 27, ], - "type": "Identifier", - "value": "string", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 3, + "column": 29, + "line": 1, }, "start": Object { - "column": 46, - "line": 3, + "column": 28, + "line": 1, }, }, "range": Array [ - 122, - 123, + 28, + 29, ], "type": "Punctuator", - "value": "|", - }, - Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 48, - "line": 3, - }, - }, - "range": Array [ - 124, - 130, - ], - "type": "Identifier", - "value": "number", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 56, - "line": 3, + "column": 1, + "line": 2, }, "start": Object { - "column": 55, - "line": 3, + "column": 0, + "line": 2, }, }, "range": Array [ - 131, - 132, + 30, + 31, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { "column": 2, - "line": 4, - }, - }, - "range": Array [ - 135, - 141, - ], - "type": "Keyword", - "value": "return", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "range": Array [ - 142, - 143, - ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 4, + "line": 2, }, "start": Object { - "column": 10, - "line": 4, - }, - }, - "range": Array [ - 143, - 144, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, + "line": 2, }, }, "range": Array [ - 145, - 146, + 31, + 32, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/function-with-await.src 1`] = ` +exports[`typescript fixtures/basics/function-overloads.src 1`] = ` Object { "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "name": "future", - "range": Array [ - 40, - 46, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 34, - 46, - ], - "type": "AwaitExpression", + "declaration": Object { + "async": false, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "start": Object { + "column": 16, + "line": 1, }, - "range": Array [ - 34, - 47, - ], - "type": "ExpressionStatement", }, - ], + "name": "f", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 1, + "column": 37, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 18, + 27, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 7, + 37, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "TSDeclareFunction", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "declaration": Object { + "async": false, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "f", + "range": Array [ + 54, + 55, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 56, + 65, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 57, + 65, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 45, + 75, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 66, + 74, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSDeclareFunction", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 75, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "x", + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 135, + 144, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 55, + "line": 3, + }, + }, + "range": Array [ + 131, + 146, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "f", + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 94, + 112, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 95, + 112, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 112, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 103, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 106, + 112, + ], + "type": "TSNumberKeyword", + }, + ], + }, + }, + }, + ], + "range": Array [ + 83, + 146, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 113, + 130, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 130, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 121, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "TSNumberKeyword", + }, + ], + }, + }, + "type": "FunctionDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 146, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 147, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 45, + 53, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 83, + 91, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 103, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 106, + 112, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 121, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 3, + }, + "start": Object { + "column": 55, + "line": 3, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-await.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "future", + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 46, + ], + "type": "AwaitExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 47, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, "line": 3, }, "start": Object { @@ -107226,132 +108167,564 @@ Object { "line": 1, }, }, - "range": Array [ - 9, - 231, - ], - "type": "TSModuleBlock", + "range": Array [ + 9, + 231, + ], + "type": "TSModuleBlock", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 31, + 44, + ], + "type": "String", + "value": "'hello world'", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "range": Array [ + 49, + 55, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, }, - "name": "A", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", }, + "range": Array [ + 56, + 61, + ], + "type": "Keyword", + "value": "class", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 12, + "column": 22, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 4, }, }, "range": Array [ - 0, - 231, + 62, + 67, ], - "type": "TSModuleDeclaration", + "type": "Identifier", + "value": "Point", }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 12, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 89, + ], + "type": "Identifier", + "value": "constructor", }, - }, - "range": Array [ - 0, - 231, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 20, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 19, + "line": 5, }, }, "range": Array [ - 0, - 6, + 89, + 90, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 90, + 96, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 27, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, ], "type": "Identifier", - "value": "module", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 29, + "line": 5, }, "start": Object { - "column": 7, - "line": 1, + "column": 28, + "line": 5, }, }, "range": Array [ - 7, - 8, + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 100, + 106, ], "type": "Identifier", - "value": "A", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 37, + "line": 5, }, "start": Object { - "column": 9, - "line": 1, + "column": 36, + "line": 5, }, }, "range": Array [ - 9, - 10, + 106, + 107, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 108, + 114, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 46, + "line": 5, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 126, + 127, ], "type": "Punctuator", "value": "{", }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 58, + "line": 5, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "}", + }, Object { "loc": Object { "end": Object { "column": 10, - "line": 3, + "line": 7, }, "start": Object { "column": 4, - "line": 3, + "line": 7, }, }, "range": Array [ - 16, - 22, + 140, + 146, ], "type": "Keyword", "value": "export", @@ -107359,593 +108732,935 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 17, + "line": 7, }, "start": Object { "column": 11, - "line": 3, + "line": 7, }, }, "range": Array [ - 23, - 26, + 147, + 153, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 166, + 172, ], "type": "Keyword", - "value": "var", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 173, + 182, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 8, + }, + "start": Object { + "column": 25, + "line": 8, + }, + }, + "range": Array [ + 183, + 185, + ], + "type": "Identifier", + "value": "Id", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 8, + }, + "start": Object { + "column": 28, + "line": 8, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 200, + 204, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 24, + "line": 9, }, "start": Object { - "column": 15, - "line": 3, + "column": 18, + "line": 9, }, }, "range": Array [ - 27, - 28, + 206, + 212, ], "type": "Identifier", - "value": "x", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 9, }, "start": Object { - "column": 17, - "line": 3, + "column": 24, + "line": 9, }, }, "range": Array [ - 29, - 30, + 212, + 213, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 9, + "line": 10, }, "start": Object { - "column": 19, - "line": 3, + "column": 8, + "line": 10, }, }, "range": Array [ - 31, - 44, + 222, + 223, ], - "type": "String", - "value": "'hello world'", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 5, + "line": 11, }, "start": Object { "column": 4, - "line": 4, + "line": 11, }, }, "range": Array [ - 49, - 55, + 228, + 229, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 1, + "line": 12, }, "start": Object { - "column": 11, - "line": 4, + "column": 0, + "line": 12, }, }, "range": Array [ - 56, - 61, + 230, + 231, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = ` +Object { + "body": Array [ Object { + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 31, + ], + "raw": "\\"hot-new-module\\"", + "type": "Literal", + "value": "hot-new-module", + }, "loc": Object { "end": Object { - "column": 22, - "line": 4, + "column": 32, + "line": 1, }, "start": Object { - "column": 17, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 62, - 67, + 0, + 32, ], - "type": "Identifier", - "value": "Point", + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 7, + "line": 1, }, "start": Object { - "column": 23, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 68, - 69, + 0, + 7, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 5, + "column": 14, + "line": 1, }, "start": Object { "column": 8, - "line": 5, + "line": 1, }, }, "range": Array [ - 78, - 89, + 8, + 14, ], "type": "Identifier", - "value": "constructor", + "value": "module", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 5, + "column": 31, + "line": 1, }, "start": Object { - "column": 19, - "line": 5, + "column": 15, + "line": 1, }, }, "range": Array [ - 89, - 90, + 15, + 31, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "\\"hot-new-module\\"", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 5, + "column": 32, + "line": 1, }, "start": Object { - "column": 20, - "line": 5, + "column": 31, + "line": 1, }, }, "range": Array [ - 90, - 96, + 31, + 32, ], - "type": "Keyword", - "value": "public", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/array-type.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 28, - "line": 5, + "column": 19, + "line": 1, }, "start": Object { - "column": 27, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 97, - 98, + 0, + 19, ], - "type": "Identifier", - "value": "x", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "TSArrayType", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 29, - "line": 5, + "column": 4, + "line": 1, }, "start": Object { - "column": 28, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 98, - 99, + 0, + 4, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 5, + "column": 8, + "line": 1, }, "start": Object { - "column": 30, - "line": 5, + "column": 5, + "line": 1, }, }, "range": Array [ - 100, - 106, + 5, + 8, ], "type": "Identifier", - "value": "number", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 5, + "column": 10, + "line": 1, }, "start": Object { - "column": 36, - "line": 5, + "column": 9, + "line": 1, }, }, "range": Array [ - 106, - 107, + 9, + 10, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 5, + "column": 17, + "line": 1, }, "start": Object { - "column": 38, - "line": 5, + "column": 11, + "line": 1, }, }, "range": Array [ - 108, - 114, + 11, + 17, ], - "type": "Keyword", - "value": "public", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 5, + "column": 18, + "line": 1, }, "start": Object { - "column": 45, - "line": 5, + "column": 17, + "line": 1, }, }, "range": Array [ - 115, - 116, + 17, + 18, ], - "type": "Identifier", - "value": "y", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 5, + "column": 19, + "line": 1, }, "start": Object { - "column": 46, - "line": 5, + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/conditional.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "TSNumberKeyword", + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 47, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSBooleanKeyword", + }, + "type": "TSConditionalType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 116, - 117, ], - "type": "Punctuator", - "value": ":", - }, - Object { + "kind": "let", "loc": Object { "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { "column": 48, - "line": 5, - }, - }, - "range": Array [ - 118, - 124, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 55, - "line": 5, + "line": 1, }, "start": Object { - "column": 54, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 124, - 125, + 0, + 48, ], - "type": "Punctuator", - "value": ")", + "type": "VariableDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 5, - }, - "start": Object { - "column": 56, - "line": 5, - }, - }, - "range": Array [ - 126, - 127, - ], - "type": "Punctuator", - "value": "{", + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, - Object { - "loc": Object { - "end": Object { - "column": 59, - "line": 5, - }, - "start": Object { - "column": 58, - "line": 5, - }, - }, - "range": Array [ - 128, - 129, - ], - "type": "Punctuator", - "value": "}", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 3, + "line": 1, }, "start": Object { - "column": 4, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 134, - 135, + 0, + 3, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 7, + "column": 5, + "line": 1, }, "start": Object { "column": 4, - "line": 7, + "line": 1, }, }, "range": Array [ - 140, - 146, + 4, + 5, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 7, + "column": 6, + "line": 1, }, "start": Object { - "column": 11, - "line": 7, + "column": 5, + "line": 1, }, }, "range": Array [ - 147, - 153, + 5, + 6, ], - "type": "Identifier", - "value": "module", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 7, + "column": 13, + "line": 1, }, "start": Object { - "column": 18, - "line": 7, + "column": 7, + "line": 1, }, }, "range": Array [ - 154, - 155, + 7, + 13, ], "type": "Identifier", - "value": "B", + "value": "number", }, Object { "loc": Object { "end": Object { "column": 21, - "line": 7, + "line": 1, }, "start": Object { - "column": 20, - "line": 7, - }, - }, - "range": Array [ - 156, - 157, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { "column": 14, - "line": 8, - }, - "start": Object { - "column": 8, - "line": 8, - }, - }, - "range": Array [ - 166, - 172, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 8, - }, - "start": Object { - "column": 15, - "line": 8, + "line": 1, }, }, "range": Array [ - 173, - 182, + 14, + 21, ], "type": "Keyword", - "value": "interface", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 8, + "column": 28, + "line": 1, }, "start": Object { - "column": 25, - "line": 8, + "column": 22, + "line": 1, }, }, "range": Array [ - 183, - 185, + 22, + 28, ], "type": "Identifier", - "value": "Id", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 8, + "column": 30, + "line": 1, }, "start": Object { - "column": 28, - "line": 8, + "column": 29, + "line": 1, }, }, "range": Array [ - 186, - 187, + 29, + 30, ], "type": "Punctuator", - "value": "{", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 9, + "column": 38, + "line": 1, }, "start": Object { - "column": 12, - "line": 9, + "column": 31, + "line": 1, }, }, "range": Array [ - 200, - 204, + 31, + 38, ], "type": "Identifier", - "value": "name", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 9, + "column": 40, + "line": 1, }, "start": Object { - "column": 16, - "line": 9, + "column": 39, + "line": 1, }, }, "range": Array [ - 204, - 205, + 39, + 40, ], "type": "Punctuator", "value": ":", @@ -107953,17 +109668,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, - "line": 9, + "column": 47, + "line": 1, }, "start": Object { - "column": 18, - "line": 9, + "column": 41, + "line": 1, }, }, "range": Array [ - 206, - 212, + 41, + 47, ], "type": "Identifier", "value": "string", @@ -107971,142 +109686,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 9, + "column": 48, + "line": 1, }, "start": Object { - "column": 24, - "line": 9, + "column": 47, + "line": 1, }, }, "range": Array [ - 212, - 213, + 47, + 48, ], "type": "Punctuator", "value": ";", }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 10, - }, - "start": Object { - "column": 8, - "line": 10, - }, - }, - "range": Array [ - 222, - 223, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 11, - }, - "start": Object { - "column": 4, - "line": 11, - }, - }, - "range": Array [ - 228, - 229, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 12, - }, - "start": Object { - "column": 0, - "line": 12, - }, - }, - "range": Array [ - 230, - 231, - ], - "type": "Punctuator", - "value": "}", - }, ], "type": "Program", } `; -exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer.src 1`] = ` Object { "body": Array [ Object { - "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 31, + "column": 12, "line": 1, }, "start": Object { - "column": 15, + "column": 5, "line": 1, }, }, + "name": "Element", "range": Array [ - 15, - 31, + 5, + 12, ], - "raw": "\\"hot-new-module\\"", - "type": "Literal", - "value": "hot-new-module", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "type": "Identifier", }, - "range": Array [ - 0, - 32, - ], - "type": "TSModuleDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 33, - ], - "sourceType": "module", - "tokens": Array [ - Object { "loc": Object { "end": Object { - "column": 7, + "column": 48, "line": 1, }, "start": Object { @@ -108116,140 +109740,270 @@ Object { }, "range": Array [ 0, - 7, - ], - "type": "Identifier", - "value": "declare", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 14, + 48, ], - "type": "Identifier", - "value": "module", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, }, - }, - "range": Array [ - 15, - 31, - ], - "type": "String", - "value": "\\"hot-new-module\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, + "extendsType": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 37, + ], + "type": "TSParenthesizedType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 39, + ], + "type": "TSArrayType", }, - "start": Object { - "column": 31, - "line": 1, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + }, }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/array-type.src 1`] = ` -Object { - "body": Array [ - Object { - "id": Object { "loc": Object { "end": Object { - "column": 8, + "column": 47, "line": 1, }, "start": Object { - "column": 5, + "column": 18, "line": 1, }, }, - "name": "Foo", "range": Array [ - 5, - 8, + 18, + 47, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 19, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "elementType": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 17, + "column": 43, "line": 1, }, "start": Object { - "column": 11, + "column": 42, "line": 1, }, }, "range": Array [ - 11, - 17, + 42, + 43, ], - "type": "TSStringKeyword", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, }, + "type": "TSConditionalType", + }, + "typeParameters": Object { "loc": Object { "end": Object { - "column": 19, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 14, + ], + "type": "TSTypeParameter", + }, + ], "range": Array [ - 11, - 19, + 12, + 15, ], - "type": "TSArrayType", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -108266,7 +110020,7 @@ Object { }, "range": Array [ 0, - 20, + 49, ], "sourceType": "module", "tokens": Array [ @@ -108291,7 +110045,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { @@ -108301,64 +110055,82 @@ Object { }, "range": Array [ 5, - 8, + 12, ], "type": "Identifier", - "value": "Foo", + "value": "Element", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 13, "line": 1, }, "start": Object { - "column": 9, + "column": 12, "line": 1, }, }, "range": Array [ - 9, - 10, + 12, + 13, ], "type": "Punctuator", - "value": "=", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 14, "line": 1, }, "start": Object { - "column": 11, + "column": 13, "line": 1, }, }, "range": Array [ - 11, - 17, + 13, + 14, ], "type": "Identifier", - "value": "string", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 15, "line": 1, }, "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { "column": 17, "line": 1, }, + "start": Object { + "column": 16, + "line": 1, + }, }, "range": Array [ + 16, 17, - 18, ], "type": "Punctuator", - "value": "[", + "value": "=", }, Object { "loc": Object { @@ -108375,315 +110147,149 @@ Object { 18, 19, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "T", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/conditional.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 47, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 47, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 13, - ], - "type": "TSNumberKeyword", - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "range": Array [ - 41, - 47, - ], - "type": "TSStringKeyword", - }, - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 47, - ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 38, - ], - "type": "TSBooleanKeyword", - }, - "type": "TSConditionalType", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 47, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", "loc": Object { "end": Object { - "column": 48, + "column": 27, "line": 1, }, "start": Object { - "column": 0, + "column": 20, "line": 1, }, }, "range": Array [ - 0, - 48, + 20, + 27, ], - "type": "VariableDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "extends", }, - }, - "range": Array [ - 0, - 49, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 29, "line": 1, }, "start": Object { - "column": 0, + "column": 28, "line": 1, }, }, "range": Array [ - 0, - 3, + 28, + 29, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 34, "line": 1, }, "start": Object { - "column": 4, + "column": 29, "line": 1, }, }, "range": Array [ - 4, - 5, + 29, + 34, ], "type": "Identifier", - "value": "x", + "value": "infer", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 36, "line": 1, }, "start": Object { - "column": 5, + "column": 35, "line": 1, }, }, "range": Array [ - 5, - 6, + 35, + 36, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "U", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 37, "line": 1, }, "start": Object { - "column": 7, + "column": 36, "line": 1, }, }, "range": Array [ - 7, - 13, + 36, + 37, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 38, "line": 1, }, "start": Object { - "column": 14, + "column": 37, "line": 1, }, }, "range": Array [ - 14, - 21, + 37, + 38, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 39, "line": 1, }, "start": Object { - "column": 22, + "column": 38, "line": 1, }, }, "range": Array [ - 22, - 28, + 38, + 39, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 41, "line": 1, }, "start": Object { - "column": 29, + "column": 40, "line": 1, }, }, "range": Array [ - 29, - 30, + 40, + 41, ], "type": "Punctuator", "value": "?", @@ -108691,35 +110297,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 43, "line": 1, }, "start": Object { - "column": 31, + "column": 42, "line": 1, }, }, "range": Array [ - 31, - 38, + 42, + 43, ], "type": "Identifier", - "value": "boolean", + "value": "U", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 45, "line": 1, }, "start": Object { - "column": 39, + "column": 44, "line": 1, }, }, "range": Array [ - 39, - 40, + 44, + 45, ], "type": "Punctuator", "value": ":", @@ -108731,16 +110337,16 @@ Object { "line": 1, }, "start": Object { - "column": 41, + "column": 46, "line": 1, }, }, "range": Array [ - 41, + 46, 47, ], "type": "Identifier", - "value": "string", + "value": "T", }, Object { "loc": Object { @@ -108765,14 +110371,14 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer-nested.src 1`] = ` Object { "body": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { @@ -108780,17 +110386,17 @@ Object { "line": 1, }, }, - "name": "Element", + "name": "Unpacked", "range": Array [ 5, - 12, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 10, + "line": 5, }, "start": Object { "column": 0, @@ -108799,41 +110405,41 @@ Object { }, "range": Array [ 0, - 48, + 126, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "checkType": Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 18, - 19, + 21, + 22, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "name": "T", "range": Array [ - 18, - 19, + 21, + 22, ], "type": "Identifier", }, @@ -108842,67 +110448,67 @@ Object { "elementType": Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 37, + 31, + 40, ], "type": "TSParenthesizedType", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 29, - 36, + 32, + 39, ], "type": "TSInferType", "typeParameter": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "name": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "name": "U", "range": Array [ - 35, - 36, + 38, + 39, ], "type": "Identifier", }, "range": Array [ - 35, - 36, + 38, + 39, ], "type": "TSTypeParameter", }, @@ -108910,100 +110516,432 @@ Object { }, "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 39, + 31, + 42, ], "type": "TSArrayType", }, "falseType": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 63, + 70, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + }, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeParameter", + }, + }, + "falseType": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "T", + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + }, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 93, + 109, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "Promise", + "range": Array [ + 93, + 100, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 101, + 108, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + }, + "range": Array [ + 107, + 108, + ], + "type": "TSTypeParameter", + }, + }, + ], + "range": Array [ + 100, + 109, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "T", + "range": Array [ + 124, + 125, + ], + "type": "Identifier", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 125, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + }, + }, + "type": "TSConditionalType", + }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 46, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 46, - 47, + 53, + 125, ], - "type": "TSTypeReference", - "typeName": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 25, + "line": 3, }, "start": Object { - "column": 46, - "line": 1, + "column": 24, + "line": 3, }, }, - "name": "T", "range": Array [ - 46, - 47, + 73, + 74, ], - "type": "Identifier", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + }, }, + "type": "TSConditionalType", }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 18, - 47, + 21, + 125, ], "trueType": Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 42, - 43, + 45, + 46, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "name": "U", "range": Array [ - 42, - 43, + 45, + 46, ], "type": "Identifier", }, @@ -109013,11 +110951,11 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, @@ -109025,42 +110963,42 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "name": Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "name": "T", "range": Array [ - 13, 14, + 15, ], "type": "Identifier", }, "range": Array [ - 13, 14, + 15, ], "type": "TSTypeParameter", }, ], "range": Array [ - 12, - 15, + 13, + 16, ], "type": "TSTypeParameterDeclaration", }, @@ -109070,7 +111008,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 6, }, "start": Object { "column": 0, @@ -109079,7 +111017,7 @@ Object { }, "range": Array [ 0, - 49, + 127, ], "sourceType": "module", "tokens": Array [ @@ -109104,7 +111042,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { @@ -109114,25 +111052,25 @@ Object { }, "range": Array [ 5, - 12, + 13, ], "type": "Identifier", - "value": "Element", + "value": "Unpacked", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], "type": "Punctuator", "value": "<", @@ -109140,17 +111078,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 15, ], "type": "Identifier", "value": "T", @@ -109158,17 +111096,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 14, + "column": 15, "line": 1, }, }, "range": Array [ - 14, 15, + 16, ], "type": "Punctuator", "value": ">", @@ -109176,17 +111114,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 16, + "column": 17, "line": 1, }, }, "range": Array [ - 16, 17, + 18, ], "type": "Punctuator", "value": "=", @@ -109194,17 +111132,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 18, - 19, + 21, + 22, ], "type": "Identifier", "value": "T", @@ -109212,17 +111150,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 20, - 27, + 23, + 30, ], "type": "Keyword", "value": "extends", @@ -109230,17 +111168,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 29, + 31, + 32, ], "type": "Punctuator", "value": "(", @@ -109248,17 +111186,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 29, - 34, + 32, + 37, ], "type": "Identifier", "value": "infer", @@ -109266,17 +111204,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 35, - 36, + 38, + 39, ], "type": "Identifier", "value": "U", @@ -109284,17 +111222,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 36, - 37, + 39, + 40, ], "type": "Punctuator", "value": ")", @@ -109302,17 +111240,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 37, - 38, + 40, + 41, ], "type": "Punctuator", "value": "[", @@ -109320,17 +111258,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 38, - 39, + 41, + 42, ], "type": "Punctuator", "value": "]", @@ -109338,17 +111276,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 25, + "line": 2, }, "start": Object { - "column": 40, - "line": 1, + "column": 24, + "line": 2, }, }, "range": Array [ - 40, - 41, + 43, + 44, ], "type": "Punctuator", "value": "?", @@ -109356,17 +111294,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 42, - 43, + 45, + 46, ], "type": "Identifier", "value": "U", @@ -109374,17 +111312,323 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 44, - "line": 1, + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 55, + 62, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 63, + 68, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 85, + 92, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 93, + 100, + ], + "type": "Identifier", + "value": "Promise", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 37, + "line": 4, }, }, "range": Array [ - 44, - 45, + 114, + 115, ], "type": "Punctuator", "value": ":", @@ -109392,17 +111636,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 46, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 46, - 47, + 124, + 125, ], "type": "Identifier", "value": "T", @@ -109410,17 +111654,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 10, + "line": 5, }, "start": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, }, "range": Array [ - 47, - 48, + 125, + 126, ], "type": "Punctuator", "value": ";", @@ -109430,14 +111674,14 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer-nested.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer-simple.src 1`] = ` Object { "body": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { @@ -109445,17 +111689,17 @@ Object { "line": 1, }, }, - "name": "Unpacked", + "name": "Foo", "range": Array [ 5, - 13, + 8, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 63, + "line": 1, }, "start": Object { "column": 0, @@ -109464,543 +111708,336 @@ Object { }, "range": Array [ 0, - 126, + 63, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "checkType": Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 22, + 14, + 15, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "name": "T", "range": Array [ - 21, - 22, + 14, + 15, ], "type": "Identifier", }, }, "extendsType": Object { - "elementType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 40, - ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 32, - 39, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": "U", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "range": Array [ - 38, - 39, - ], - "type": "TSTypeParameter", - }, - }, - }, "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 50, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 42, - ], - "type": "TSArrayType", - }, - "falseType": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "T", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 63, - 70, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "name": "U", - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - }, - "range": Array [ - 69, - 70, - ], - "type": "TSTypeParameter", + "column": 24, + "line": 1, }, }, - "falseType": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 84, - ], - "type": "TSTypeReference", - "typeName": Object { + "members": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 27, + "line": 1, }, "start": Object { - "column": 6, - "line": 4, + "column": 26, + "line": 1, }, }, - "name": "T", + "name": "a", "range": Array [ - 83, - 84, + 26, + 27, ], "type": "Identifier", }, - }, - "extendsType": Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 37, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 26, + "line": 1, }, }, "range": Array [ - 93, - 109, + 26, + 37, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 27, + "line": 1, }, }, - "name": "Promise", "range": Array [ - 93, - 100, + 27, + 36, ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 4, - }, - "start": Object { - "column": 23, - "line": 4, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "range": Array [ + 29, + 36, + ], + "type": "TSInferType", + "typeParameter": Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 24, - "line": 4, + "column": 35, + "line": 1, }, }, - "range": Array [ - 101, - 108, - ], - "type": "TSInferType", - "typeParameter": Object { + "name": Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 30, - "line": 4, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 4, - }, - "start": Object { - "column": 30, - "line": 4, - }, + "column": 35, + "line": 1, }, - "name": "U", - "range": Array [ - 107, - 108, - ], - "type": "Identifier", }, + "name": "U", "range": Array [ - 107, - 108, + 35, + 36, ], - "type": "TSTypeParameter", + "type": "Identifier", }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", }, - ], - "range": Array [ - 100, - 109, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 5, }, }, - "range": Array [ - 124, - 125, - ], - "type": "TSTypeReference", - "typeName": Object { + }, + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 39, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 38, + "line": 1, }, }, - "name": "T", + "name": "b", "range": Array [ - 124, - 125, + 38, + 39, ], "type": "Identifier", }, - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 125, - ], - "trueType": Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 38, + "line": 1, }, }, "range": Array [ - 112, - 113, + 38, + 48, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "range": Array [ + 47, + 48, + ], + "type": "TSTypeParameter", }, }, - "name": "U", - "range": Array [ - 112, - 113, - ], - "type": "Identifier", }, }, - "type": "TSConditionalType", - }, + ], + "range": Array [ + 24, + 50, + ], + "type": "TSTypeLiteral", + }, + "falseType": Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 57, + "line": 1, }, }, "range": Array [ - 53, - 125, + 57, + 62, ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "range": Array [ - 73, - 74, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "name": "U", - "range": Array [ - 73, - 74, - ], - "type": "Identifier", - }, - }, - "type": "TSConditionalType", + "type": "TSNeverKeyword", }, "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 125, + 14, + 62, ], "trueType": Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 54, + "line": 1, }, "start": Object { - "column": 26, - "line": 2, + "column": 53, + "line": 1, }, }, "range": Array [ - 45, - 46, + 53, + 54, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 54, + "line": 1, }, "start": Object { - "column": 26, - "line": 2, + "column": 53, + "line": 1, }, }, "name": "U", "range": Array [ - 45, - 46, + 53, + 54, ], "type": "Identifier", }, @@ -110010,11 +112047,11 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, @@ -110022,42 +112059,42 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "name": Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "name": "T", "range": Array [ - 14, - 15, + 9, + 10, ], "type": "Identifier", }, "range": Array [ - 14, - 15, + 9, + 10, ], "type": "TSTypeParameter", }, ], "range": Array [ - 13, - 16, + 8, + 11, ], "type": "TSTypeParameterDeclaration", }, @@ -110067,7 +112104,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 2, }, "start": Object { "column": 0, @@ -110076,7 +112113,7 @@ Object { }, "range": Array [ 0, - 127, + 64, ], "sourceType": "module", "tokens": Array [ @@ -110101,7 +112138,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { @@ -110111,25 +112148,25 @@ Object { }, "range": Array [ 5, - 13, + 8, ], "type": "Identifier", - "value": "Unpacked", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 9, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, "range": Array [ - 13, - 14, + 8, + 9, ], "type": "Punctuator", "value": "<", @@ -110137,17 +112174,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "range": Array [ - 14, - 15, + 9, + 10, ], "type": "Identifier", "value": "T", @@ -110155,17 +112192,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 15, + "column": 10, "line": 1, }, }, "range": Array [ - 15, - 16, + 10, + 11, ], "type": "Punctuator", "value": ">", @@ -110173,17 +112210,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 13, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 18, + 12, + 13, ], "type": "Punctuator", "value": "=", @@ -110191,17 +112228,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 22, + 14, + 15, ], "type": "Identifier", "value": "T", @@ -110209,179 +112246,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ + 16, 23, - 30, ], "type": "Keyword", "value": "extends", }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 32, - 37, - ], - "type": "Identifier", - "value": "infer", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - "value": "U", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 40, - 41, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 41, - 42, - ], - "type": "Punctuator", - "value": "]", - }, Object { "loc": Object { "end": Object { "column": 25, - "line": 2, + "line": 1, }, "start": Object { "column": 24, - "line": 2, + "line": 1, }, }, "range": Array [ - 43, - 44, + 24, + 25, ], "type": "Punctuator", - "value": "?", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 27, - "line": 2, + "line": 1, }, "start": Object { "column": 26, - "line": 2, + "line": 1, }, }, "range": Array [ - 45, - 46, + 26, + 27, ], "type": "Identifier", - "value": "U", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { - "column": 28, - "line": 2, + "column": 27, + "line": 1, }, }, "range": Array [ - 47, - 48, + 27, + 28, ], "type": "Punctuator", "value": ":", @@ -110389,53 +112318,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 55, - 62, - ], - "type": "Keyword", - "value": "extends", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, + "column": 34, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 29, + "line": 1, }, }, "range": Array [ - 63, - 68, + 29, + 34, ], "type": "Identifier", "value": "infer", @@ -110443,53 +112336,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - "value": "U", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 22, - "line": 3, - }, - }, - "range": Array [ - 71, - 72, - ], - "type": "Punctuator", - "value": "?", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, + "column": 36, + "line": 1, }, "start": Object { - "column": 24, - "line": 3, + "column": 35, + "line": 1, }, }, "range": Array [ - 73, - 74, + 35, + 36, ], "type": "Identifier", "value": "U", @@ -110497,107 +112354,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 37, + "line": 1, }, "start": Object { - "column": 26, - "line": 3, + "column": 36, + "line": 1, }, }, "range": Array [ - 75, - 76, + 36, + 37, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 84, - ], - "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 85, - 92, - ], - "type": "Keyword", - "value": "extends", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 39, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 38, + "line": 1, }, }, "range": Array [ - 93, - 100, + 38, + 39, ], "type": "Identifier", - "value": "Promise", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 40, + "line": 1, }, - "start": Object { - "column": 23, - "line": 4, + "start": Object { + "column": 39, + "line": 1, }, }, "range": Array [ - 100, - 101, + 39, + 40, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 4, + "column": 46, + "line": 1, }, "start": Object { - "column": 24, - "line": 4, + "column": 41, + "line": 1, }, }, "range": Array [ - 101, - 106, + 41, + 46, ], "type": "Identifier", "value": "infer", @@ -110605,17 +112426,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 30, - "line": 4, + "column": 47, + "line": 1, }, }, "range": Array [ - 107, - 108, + 47, + 48, ], "type": "Identifier", "value": "U", @@ -110623,35 +112444,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 50, + "line": 1, }, "start": Object { - "column": 31, - "line": 4, + "column": 49, + "line": 1, }, }, "range": Array [ - 108, - 109, + 49, + 50, ], "type": "Punctuator", - "value": ">", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 4, + "column": 52, + "line": 1, }, "start": Object { - "column": 33, - "line": 4, + "column": 51, + "line": 1, }, }, "range": Array [ - 110, - 111, + 51, + 52, ], "type": "Punctuator", "value": "?", @@ -110659,17 +112480,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 54, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 53, + "line": 1, }, }, "range": Array [ - 112, - 113, + 53, + 54, ], "type": "Identifier", "value": "U", @@ -110677,17 +112498,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 4, + "column": 56, + "line": 1, }, "start": Object { - "column": 37, - "line": 4, + "column": 55, + "line": 1, }, }, "range": Array [ - 114, - 115, + 55, + 56, ], "type": "Punctuator", "value": ":", @@ -110695,35 +112516,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 57, + "line": 1, }, }, "range": Array [ - 124, - 125, + 57, + 62, ], "type": "Identifier", - "value": "T", + "value": "never", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 63, + "line": 1, }, "start": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, }, "range": Array [ - 125, - 126, + 62, + 63, ], "type": "Punctuator", "value": ";", @@ -110733,430 +112554,166 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer-simple.src 1`] = ` +exports[`typescript fixtures/types/conditional-with-null.src 1`] = ` Object { "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 63, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 63, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeReference", - "typeName": Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 45, "line": 1, }, "start": Object { - "column": 14, + "column": 4, "line": 1, }, }, - "name": "T", + "name": "x", "range": Array [ - 14, - 15, + 4, + 45, ], "type": "Identifier", - }, - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 1, }, "start": Object { - "column": 26, + "column": 5, "line": 1, }, }, "range": Array [ - 26, - 37, + 5, + 45, ], - "type": "TSPropertySignature", + "type": "TSTypeAnnotation", "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 36, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "checkType": Object { "loc": Object { "end": Object { - "column": 36, + "column": 13, "line": 1, }, "start": Object { - "column": 29, + "column": 7, "line": 1, }, }, "range": Array [ - 29, - 36, + 7, + 13, ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, + "type": "TSNumberKeyword", + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", + "start": Object { + "column": 22, + "line": 1, }, - "range": Array [ - 35, - 36, - ], - "type": "TSTypeParameter", }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", }, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, }, + "range": Array [ + 41, + 45, + ], + "type": "TSNullKeyword", }, - "name": "b", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 48, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 48, + "column": 45, "line": 1, }, "start": Object { - "column": 39, + "column": 7, "line": 1, }, }, "range": Array [ - 39, - 48, + 7, + 45, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 41, + "column": 38, "line": 1, }, - }, - "range": Array [ - 41, - 48, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 47, - 48, - ], - "type": "Identifier", - }, - "range": Array [ - 47, - 48, - ], - "type": "TSTypeParameter", - }, - }, - }, - }, - ], - "range": Array [ - 24, - 50, - ], - "type": "TSTypeLiteral", - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 57, - "line": 1, - }, - }, - "range": Array [ - 57, - 62, - ], - "type": "TSNeverKeyword", - }, - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 62, - ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - }, - "type": "TSConditionalType", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSBooleanKeyword", }, + "type": "TSConditionalType", }, - "name": "T", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, - "range": Array [ - 9, - 10, - ], - "type": "TSTypeParameter", }, - ], - "range": Array [ - 8, - 11, - ], - "type": "TSTypeParameterDeclaration", + "init": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", }, ], "comments": Array [], @@ -111172,14 +112729,14 @@ Object { }, "range": Array [ 0, - 64, + 47, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 3, "line": 1, }, "start": Object { @@ -111189,15 +112746,33 @@ Object { }, "range": Array [ 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ 4, + 5, ], "type": "Identifier", - "value": "type", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -111207,169 +112782,462 @@ Object { }, "range": Array [ 5, - 8, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, ], "type": "Identifier", - "value": "Foo", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 21, "line": 1, }, "start": Object { - "column": 8, + "column": 14, "line": 1, }, }, "range": Array [ - 8, - 9, + 14, + 21, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 28, "line": 1, }, "start": Object { - "column": 9, + "column": 22, "line": 1, }, }, "range": Array [ - 9, - 10, + 22, + 28, ], "type": "Identifier", - "value": "T", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 30, "line": 1, }, "start": Object { - "column": 10, + "column": 29, "line": 1, }, }, "range": Array [ - 10, - 11, + 29, + 30, ], "type": "Punctuator", - "value": ">", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 38, "line": 1, }, "start": Object { - "column": 12, + "column": 31, "line": 1, }, }, "range": Array [ - 12, - 13, + 31, + 38, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 40, "line": 1, }, "start": Object { - "column": 14, + "column": 39, "line": 1, }, }, "range": Array [ - 14, - 15, + 39, + 40, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 45, "line": 1, }, "start": Object { - "column": 16, + "column": 41, "line": 1, }, }, "range": Array [ - 16, - 23, + 41, + 45, ], "type": "Keyword", - "value": "extends", + "value": "null", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 46, "line": 1, }, "start": Object { - "column": 24, + "column": 45, "line": 1, }, }, "range": Array [ - 24, - 25, + 45, + 46, ], "type": "Punctuator", - "value": "{", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 4, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 23, + 33, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 7, + 42, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSConstructorType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 42, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 27, + "column": 3, "line": 1, }, "start": Object { - "column": 26, + "column": 0, "line": 1, }, }, "range": Array [ - 26, - 27, + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, ], "type": "Identifier", - "value": "a", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 6, "line": 1, }, "start": Object { - "column": 27, + "column": 5, "line": 1, }, }, "range": Array [ - 27, - 28, + 5, + 6, ], "type": "Punctuator", "value": ":", @@ -111377,233 +113245,251 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 10, "line": 1, }, "start": Object { - "column": 29, + "column": 7, "line": 1, }, }, "range": Array [ - 29, - 34, + 7, + 10, ], - "type": "Identifier", - "value": "infer", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 12, "line": 1, }, "start": Object { - "column": 35, + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, "line": 1, }, }, "range": Array [ - 35, - 36, + 12, + 13, ], "type": "Identifier", - "value": "U", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 14, "line": 1, }, "start": Object { - "column": 36, + "column": 13, "line": 1, }, }, "range": Array [ - 36, - 37, + 13, + 14, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 21, "line": 1, }, "start": Object { - "column": 38, + "column": 15, "line": 1, }, }, "range": Array [ - 38, - 39, + 15, + 21, ], "type": "Identifier", - "value": "b", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 22, "line": 1, }, "start": Object { - "column": 39, + "column": 21, "line": 1, }, }, "range": Array [ - 39, - 40, + 21, + 22, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 24, "line": 1, }, "start": Object { - "column": 41, + "column": 23, "line": 1, }, }, "range": Array [ - 41, - 46, + 23, + 24, ], "type": "Identifier", - "value": "infer", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 25, "line": 1, }, "start": Object { - "column": 47, + "column": 24, "line": 1, }, }, "range": Array [ - 47, - 48, + 24, + 25, ], - "type": "Identifier", - "value": "U", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 50, + "column": 26, "line": 1, }, "start": Object { - "column": 49, + "column": 25, "line": 1, }, }, "range": Array [ - 49, - 50, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 52, + "column": 33, "line": 1, }, "start": Object { - "column": 51, + "column": 27, "line": 1, }, }, "range": Array [ - 51, - 52, + 27, + 33, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 54, + "column": 34, "line": 1, }, "start": Object { - "column": 53, + "column": 33, "line": 1, }, }, "range": Array [ - 53, - 54, + 33, + 34, ], - "type": "Identifier", - "value": "U", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 56, + "column": 37, "line": 1, }, "start": Object { - "column": 55, + "column": 35, "line": 1, }, }, "range": Array [ - 55, - 56, + 35, + 37, ], "type": "Punctuator", - "value": ":", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 62, + "column": 42, "line": 1, }, "start": Object { - "column": 57, + "column": 38, "line": 1, }, }, "range": Array [ - 57, - 62, + 38, + 42, ], - "type": "Identifier", - "value": "never", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 63, + "column": 43, "line": 1, }, "start": Object { - "column": 62, + "column": 42, "line": 1, }, }, "range": Array [ - 62, - 63, + 42, + 43, ], "type": "Punctuator", "value": ";", @@ -111613,7 +113499,7 @@ Object { } `; -exports[`typescript fixtures/types/conditional-with-null.src 1`] = ` +exports[`typescript fixtures/types/constructor-generic.src 1`] = ` Object { "body": Array [ Object { @@ -111622,7 +113508,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -111630,16 +113516,16 @@ Object { "line": 1, }, }, - "name": "x", + "name": "f", "range": Array [ 4, - 45, + 25, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -111649,100 +113535,210 @@ Object { }, "range": Array [ 5, - 45, + 25, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, }, - "range": Array [ - 7, - 13, - ], - "type": "TSNumberKeyword", }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, }, - "start": Object { - "column": 22, - "line": 1, + "name": "a", + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + }, }, }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - "falseType": Object { + ], + "range": Array [ + 7, + 25, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { - "column": 41, + "column": 21, "line": 1, }, }, "range": Array [ - 41, - 45, + 21, + 25, ], - "type": "TSNullKeyword", - }, - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + }, }, }, - "range": Array [ - 7, - 45, - ], - "trueType": Object { + "type": "TSConstructorType", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 38, + "column": 14, "line": 1, }, "start": Object { - "column": 31, + "column": 11, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "range": Array [ + 12, + 13, + ], + "type": "TSTypeParameter", + }, + ], "range": Array [ - 31, - 38, + 11, + 14, ], - "type": "TSBooleanKeyword", + "type": "TSTypeParameterDeclaration", }, - "type": "TSConditionalType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -111752,7 +113748,7 @@ Object { }, "range": Array [ 4, - 45, + 25, ], "type": "VariableDeclarator", }, @@ -111760,7 +113756,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 46, + "column": 26, "line": 1, }, "start": Object { @@ -111770,7 +113766,7 @@ Object { }, "range": Array [ 0, - 46, + 26, ], "type": "VariableDeclaration", }, @@ -111788,7 +113784,7 @@ Object { }, "range": Array [ 0, - 47, + 27, ], "sourceType": "module", "tokens": Array [ @@ -111826,7 +113822,7 @@ Object { 5, ], "type": "Identifier", - "value": "x", + "value": "f", }, Object { "loc": Object { @@ -111849,7 +113845,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 1, }, "start": Object { @@ -111859,15 +113855,69 @@ Object { }, "range": Array [ 7, + 10, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, 13, ], "type": "Identifier", - "value": "number", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, "line": 1, }, "start": Object { @@ -111877,115 +113927,133 @@ Object { }, "range": Array [ 14, - 21, + 15, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 16, "line": 1, }, "start": Object { - "column": 22, + "column": 15, "line": 1, }, }, "range": Array [ - 22, - 28, + 15, + 16, ], "type": "Identifier", - "value": "string", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 17, "line": 1, }, "start": Object { - "column": 29, + "column": 16, "line": 1, }, }, "range": Array [ - 29, - 30, + 16, + 17, ], "type": "Punctuator", - "value": "?", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 19, "line": 1, }, "start": Object { - "column": 31, + "column": 18, "line": 1, }, }, "range": Array [ - 31, - 38, + 18, + 19, ], "type": "Identifier", - "value": "boolean", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 20, "line": 1, }, "start": Object { - "column": 39, + "column": 19, "line": 1, }, }, "range": Array [ - 39, - 40, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 45, + "column": 23, "line": 1, }, "start": Object { - "column": 41, + "column": 21, "line": 1, }, }, "range": Array [ - 41, - 45, + 21, + 23, ], - "type": "Keyword", - "value": "null", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 25, "line": 1, }, "start": Object { - "column": 45, + "column": 24, "line": 1, }, }, "range": Array [ - 45, - 46, + 24, + 25, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -111995,7 +114063,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor.src 1`] = ` +exports[`typescript fixtures/types/constructor-in-generic.src 1`] = ` Object { "body": Array [ Object { @@ -112004,7 +114072,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -112012,16 +114080,16 @@ Object { "line": 1, }, }, - "name": "f", + "name": "x", "range": Array [ 4, - 42, + 30, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -112031,13 +114099,13 @@ Object { }, "range": Array [ 5, - 42, + 30, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -112045,28 +114113,45 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "range": Array [ + 7, + 30, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "name": "a", - "range": Array [ - 12, - 21, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 21, + "column": 29, "line": 1, }, "start": Object { @@ -112074,130 +114159,61 @@ Object { "line": 1, }, }, + "params": Array [], "range": Array [ 13, - 21, + 29, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 21, + "column": 29, "line": 1, }, "start": Object { - "column": 15, + "column": 20, "line": 1, }, }, "range": Array [ - 15, - 21, + 20, + 29, ], - "type": "TSNumberKeyword", - }, - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "b", - "optional": true, - "range": Array [ - 23, - 33, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 33, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, }, + "range": Array [ + 23, + 29, + ], + "type": "TSStringKeyword", }, - "range": Array [ - 27, - 33, - ], - "type": "TSNumberKeyword", }, + "type": "TSConstructorType", }, - }, - ], - "range": Array [ - 7, - 42, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, + ], "range": Array [ - 35, - 42, + 12, + 30, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 42, - ], - "type": "TSVoidKeyword", - }, + "type": "TSTypeParameterInstantiation", }, - "type": "TSConstructorType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -112207,7 +114223,7 @@ Object { }, "range": Array [ 4, - 42, + 30, ], "type": "VariableDeclarator", }, @@ -112215,7 +114231,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 43, + "column": 31, "line": 1, }, "start": Object { @@ -112225,7 +114241,7 @@ Object { }, "range": Array [ 0, - 43, + 31, ], "type": "VariableDeclaration", }, @@ -112243,7 +114259,7 @@ Object { }, "range": Array [ 0, - 44, + 32, ], "sourceType": "module", "tokens": Array [ @@ -112281,7 +114297,7 @@ Object { 5, ], "type": "Identifier", - "value": "f", + "value": "x", }, Object { "loc": Object { @@ -112304,7 +114320,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { @@ -112314,28 +114330,10 @@ Object { }, "range": Array [ 7, - 10, - ], - "type": "Keyword", - "value": "new", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, 12, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { @@ -112352,13 +114350,13 @@ Object { 12, 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { @@ -112368,187 +114366,115 @@ Object { }, "range": Array [ 13, - 14, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 21, + 16, ], - "type": "Identifier", - "value": "number", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 18, "line": 1, }, "start": Object { - "column": 21, + "column": 17, "line": 1, }, }, "range": Array [ - 21, - 22, + 17, + 18, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - "value": "b", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 19, "line": 1, }, "start": Object { - "column": 24, + "column": 18, "line": 1, }, }, "range": Array [ - 24, - 25, + 18, + 19, ], "type": "Punctuator", - "value": "?", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 22, "line": 1, }, "start": Object { - "column": 25, + "column": 20, "line": 1, }, }, "range": Array [ - 25, - 26, + 20, + 22, ], "type": "Punctuator", - "value": ":", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 29, "line": 1, }, "start": Object { - "column": 27, + "column": 23, "line": 1, }, }, "range": Array [ - 27, - 33, + 23, + 29, ], "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 34, - ], - "type": "Punctuator", - "value": ")", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 30, "line": 1, }, "start": Object { - "column": 35, + "column": 29, "line": 1, }, }, "range": Array [ - 35, - 37, + 29, + 30, ], "type": "Punctuator", - "value": "=>", - }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 42, - ], - "type": "Keyword", - "value": "void", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 31, "line": 1, }, "start": Object { - "column": 42, + "column": 30, "line": 1, }, }, "range": Array [ - 42, - 43, + 30, + 31, ], "type": "Punctuator", "value": ";", @@ -112558,7 +114484,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-generic.src 1`] = ` +exports[`typescript fixtures/types/constructor-with-rest.src 1`] = ` Object { "body": Array [ Object { @@ -112567,7 +114493,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -112578,13 +114504,13 @@ Object { "name": "f", "range": Array [ 4, - 25, + 35, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -112594,13 +114520,13 @@ Object { }, "range": Array [ 5, - 25, + 35, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -112610,194 +114536,138 @@ Object { }, "params": Array [ Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 15, - 19, - ], - "type": "Identifier", - "typeAnnotation": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 19, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, + "name": "a", "range": Array [ + 15, 16, - 19, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - }, - }, - }, - ], - "range": Array [ - 7, - 25, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + "type": "Identifier", }, - }, - "range": Array [ - 21, - 25, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 26, "line": 1, }, "start": Object { - "column": 24, + "column": 12, "line": 1, }, }, "range": Array [ - 24, - 25, + 12, + 26, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 24, - 25, - ], - "type": "Identifier", - }, - }, - }, - "type": "TSConstructorType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "params": Array [ - Object { + "type": "RestElement", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 13, + "column": 26, "line": 1, }, "start": Object { - "column": 12, + "column": 16, "line": 1, }, }, - "name": Object { + "range": Array [ + 16, + 26, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "TSNumberKeyword", + }, "loc": Object { "end": Object { - "column": 13, + "column": 26, "line": 1, }, "start": Object { - "column": 12, + "column": 18, "line": 1, }, }, - "name": "T", "range": Array [ - 12, - 13, + 18, + 26, ], - "type": "Identifier", + "type": "TSArrayType", }, - "range": Array [ - 12, - 13, - ], - "type": "TSTypeParameter", }, - ], + }, + ], + "range": Array [ + 7, + 35, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, "range": Array [ - 11, - 14, + 28, + 35, ], - "type": "TSTypeParameterDeclaration", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSConstructorType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -112807,7 +114677,7 @@ Object { }, "range": Array [ 4, - 25, + 35, ], "type": "VariableDeclarator", }, @@ -112815,7 +114685,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { @@ -112825,7 +114695,7 @@ Object { }, "range": Array [ 0, - 26, + 36, ], "type": "VariableDeclaration", }, @@ -112843,7 +114713,7 @@ Object { }, "range": Array [ 0, - 27, + 37, ], "sourceType": "module", "tokens": Array [ @@ -112935,12 +114805,12 @@ Object { 12, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { @@ -112950,115 +114820,115 @@ Object { }, "range": Array [ 12, - 13, + 15, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { - "column": 13, + "column": 15, "line": 1, }, }, "range": Array [ - 13, - 14, + 15, + 16, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { - "column": 14, + "column": 16, "line": 1, }, }, "range": Array [ - 14, - 15, + 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 1, }, "start": Object { - "column": 15, + "column": 18, "line": 1, }, }, "range": Array [ - 15, - 16, + 18, + 24, ], "type": "Identifier", - "value": "a", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 1, }, "start": Object { - "column": 16, + "column": 24, "line": 1, }, }, "range": Array [ - 16, - 17, + 24, + 25, ], "type": "Punctuator", - "value": ":", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 26, "line": 1, }, "start": Object { - "column": 18, + "column": 25, "line": 1, }, }, "range": Array [ - 18, - 19, + 25, + 26, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 27, "line": 1, }, "start": Object { - "column": 19, + "column": 26, "line": 1, }, }, "range": Array [ - 19, - 20, + 26, + 27, ], "type": "Punctuator", "value": ")", @@ -113066,17 +114936,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 30, "line": 1, }, "start": Object { - "column": 21, + "column": 28, "line": 1, }, }, "range": Array [ - 21, - 23, + 28, + 30, ], "type": "Punctuator", "value": "=>", @@ -113084,35 +114954,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { - "column": 24, + "column": 31, "line": 1, }, }, "range": Array [ - 24, - 25, + 31, + 35, ], - "type": "Identifier", - "value": "T", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { - "column": 25, + "column": 35, "line": 1, }, }, "range": Array [ - 25, - 26, + 35, + 36, ], "type": "Punctuator", "value": ";", @@ -113122,7 +114992,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-in-generic.src 1`] = ` +exports[`typescript fixtures/types/function.src 1`] = ` Object { "body": Array [ Object { @@ -113131,7 +115001,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -113139,16 +115009,16 @@ Object { "line": 1, }, }, - "name": "x", + "name": "f", "range": Array [ 4, - 30, + 38, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -113158,13 +115028,13 @@ Object { }, "range": Array [ 5, - 30, + 38, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -113172,107 +115042,159 @@ Object { "line": 1, }, }, - "range": Array [ - 7, - 30, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, - "start": Object { - "column": 7, - "line": 1, + "name": "a", + "range": Array [ + 8, + 17, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, }, }, - "name": "Array", - "range": Array [ - 7, - 12, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "name": "b", + "optional": true, + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 29, "line": 1, }, "start": Object { - "column": 13, + "column": 21, "line": 1, }, }, - "params": Array [], "range": Array [ - 13, + 21, 29, ], - "returnType": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 29, "line": 1, }, "start": Object { - "column": 20, + "column": 23, "line": 1, }, }, "range": Array [ - 20, + 23, 29, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 29, - ], - "type": "TSStringKeyword", - }, + "type": "TSNumberKeyword", }, - "type": "TSConstructorType", }, - ], + }, + ], + "range": Array [ + 7, + 38, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, "range": Array [ - 12, - 30, + 31, + 38, ], - "type": "TSTypeParameterInstantiation", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -113282,7 +115204,7 @@ Object { }, "range": Array [ 4, - 30, + 38, ], "type": "VariableDeclarator", }, @@ -113290,7 +115212,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 1, }, "start": Object { @@ -113300,7 +115222,7 @@ Object { }, "range": Array [ 0, - 31, + 39, ], "type": "VariableDeclaration", }, @@ -113318,7 +115240,7 @@ Object { }, "range": Array [ 0, - 32, + 40, ], "sourceType": "module", "tokens": Array [ @@ -113356,7 +115278,7 @@ Object { 5, ], "type": "Identifier", - "value": "x", + "value": "f", }, Object { "loc": Object { @@ -113379,7 +115301,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 1, }, "start": Object { @@ -113389,46 +115311,64 @@ Object { }, "range": Array [ 7, - 12, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, ], "type": "Identifier", - "value": "Array", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 1, }, "start": Object { - "column": 12, + "column": 9, "line": 1, }, }, "range": Array [ - 12, - 13, + 9, + 10, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 1, }, "start": Object { - "column": 13, + "column": 11, "line": 1, }, }, "range": Array [ - 13, - 16, + 11, + 17, ], - "type": "Keyword", - "value": "new", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { @@ -113446,30 +115386,30 @@ Object { 18, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 1, }, "start": Object { - "column": 18, + "column": 19, "line": 1, }, }, "range": Array [ - 18, 19, + 20, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 21, "line": 1, }, "start": Object { @@ -113479,10 +115419,28 @@ Object { }, "range": Array [ 20, + 21, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, 22, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { @@ -113500,7 +115458,7 @@ Object { 29, ], "type": "Identifier", - "value": "string", + "value": "number", }, Object { "loc": Object { @@ -113517,23 +115475,59 @@ Object { 29, 30, ], - "type": "Punctuator", - "value": ">", + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 33, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 1, }, "start": Object { - "column": 30, + "column": 38, "line": 1, }, }, "range": Array [ - 30, - 31, + 38, + 39, ], "type": "Punctuator", "value": ";", @@ -113543,7 +115537,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-with-rest.src 1`] = ` +exports[`typescript fixtures/types/function-generic.src 1`] = ` Object { "body": Array [ Object { @@ -113552,7 +115546,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -113563,13 +115557,13 @@ Object { "name": "f", "range": Array [ 4, - 35, + 21, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -113579,13 +115573,13 @@ Object { }, "range": Array [ 5, - 35, + 21, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -113595,138 +115589,194 @@ Object { }, "params": Array [ Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, + "name": "a", "range": Array [ - 12, - 26, + 11, + 15, ], - "type": "RestElement", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 16, + "column": 12, "line": 1, }, }, "range": Array [ - 16, - 26, + 12, + 15, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { - "elementType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 24, + "column": 15, "line": 1, }, "start": Object { - "column": 18, + "column": 14, "line": 1, }, }, + "name": "T", "range": Array [ - 18, - 24, + 14, + 15, ], - "type": "TSNumberKeyword", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "type": "Identifier", }, - "range": Array [ - 18, - 26, - ], - "type": "TSArrayType", }, }, }, ], "range": Array [ 7, - 35, + 21, ], "returnType": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ - 28, - 35, + 17, + 21, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 31, + "column": 20, "line": 1, }, }, "range": Array [ - 31, - 35, + 20, + 21, ], - "type": "TSVoidKeyword", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, }, }, - "type": "TSConstructorType", + "type": "TSFunctionType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 9, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "TSTypeParameterDeclaration", + }, }, }, }, "init": null, "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -113736,7 +115786,7 @@ Object { }, "range": Array [ 4, - 35, + 21, ], "type": "VariableDeclarator", }, @@ -113744,7 +115794,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 36, + "column": 22, "line": 1, }, "start": Object { @@ -113754,7 +115804,7 @@ Object { }, "range": Array [ 0, - 36, + 22, ], "type": "VariableDeclaration", }, @@ -113772,7 +115822,7 @@ Object { }, "range": Array [ 0, - 37, + 23, ], "sourceType": "module", "tokens": Array [ @@ -113833,7 +115883,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 1, }, "start": Object { @@ -113843,151 +115893,133 @@ Object { }, "range": Array [ 7, - 10, - ], - "type": "Keyword", - "value": "new", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, + 8, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { - "column": 12, + "column": 8, "line": 1, }, }, "range": Array [ - 12, - 15, + 8, + 9, ], - "type": "Punctuator", - "value": "...", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { - "column": 15, + "column": 9, "line": 1, }, }, "range": Array [ - 15, - 16, + 9, + 10, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 17, + 10, + 11, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 12, "line": 1, }, "start": Object { - "column": 18, + "column": 11, "line": 1, }, }, "range": Array [ - 18, - 24, + 11, + 12, ], "type": "Identifier", - "value": "number", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 13, "line": 1, }, "start": Object { - "column": 24, + "column": 12, "line": 1, }, }, "range": Array [ - 24, - 25, + 12, + 13, ], "type": "Punctuator", - "value": "[", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 25, + "column": 14, "line": 1, }, }, "range": Array [ - 25, - 26, + 14, + 15, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 16, "line": 1, }, "start": Object { - "column": 26, + "column": 15, "line": 1, }, }, "range": Array [ - 26, - 27, + 15, + 16, ], "type": "Punctuator", "value": ")", @@ -113995,17 +116027,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 19, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ - 28, - 30, + 17, + 19, ], "type": "Punctuator", "value": "=>", @@ -114013,35 +116045,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 31, + "column": 20, "line": 1, }, }, "range": Array [ - 31, - 35, + 20, + 21, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 22, "line": 1, }, "start": Object { - "column": 35, + "column": 21, "line": 1, }, }, "range": Array [ - 35, - 36, + 21, + 22, ], "type": "Punctuator", "value": ";", @@ -114051,7 +116083,7 @@ Object { } `; -exports[`typescript fixtures/types/function.src 1`] = ` +exports[`typescript fixtures/types/function-in-generic.src 1`] = ` Object { "body": Array [ Object { @@ -114060,7 +116092,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -114068,16 +116100,16 @@ Object { "line": 1, }, }, - "name": "f", + "name": "x", "range": Array [ 4, - 38, + 24, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -114087,13 +116119,13 @@ Object { }, "range": Array [ 5, - 38, + 24, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -114101,159 +116133,107 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "range": Array [ + 7, + 24, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "name": "a", - "range": Array [ - 8, - 17, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 17, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 17, - ], - "type": "TSNumberKeyword", - }, + "start": Object { + "column": 7, + "line": 1, }, }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, + "name": "Array", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, }, - "name": "b", - "optional": true, - "range": Array [ - 19, - 29, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 21, + "column": 13, "line": 1, }, }, + "params": Array [], "range": Array [ - 21, - 29, + 13, + 23, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 23, + "column": 16, "line": 1, }, }, "range": Array [ + 16, 23, - 29, ], - "type": "TSNumberKeyword", - }, - }, - }, - ], - "range": Array [ - 7, - 38, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 38, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, - "range": Array [ - 34, - 38, - ], - "type": "TSVoidKeyword", - }, + ], + "range": Array [ + 12, + 24, + ], + "type": "TSTypeParameterInstantiation", }, - "type": "TSFunctionType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -114263,7 +116243,7 @@ Object { }, "range": Array [ 4, - 38, + 24, ], "type": "VariableDeclarator", }, @@ -114271,7 +116251,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 39, + "column": 25, "line": 1, }, "start": Object { @@ -114281,7 +116261,7 @@ Object { }, "range": Array [ 0, - 39, + 25, ], "type": "VariableDeclaration", }, @@ -114299,7 +116279,7 @@ Object { }, "range": Array [ 0, - 40, + 26, ], "sourceType": "module", "tokens": Array [ @@ -114337,7 +116317,7 @@ Object { 5, ], "type": "Identifier", - "value": "f", + "value": "x", }, Object { "loc": Object { @@ -114360,7 +116340,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { @@ -114370,64 +116350,64 @@ Object { }, "range": Array [ 7, - 8, + 12, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { - "column": 8, + "column": 12, "line": 1, }, }, "range": Array [ - 8, - 9, + 12, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 14, "line": 1, }, "start": Object { - "column": 9, + "column": 13, "line": 1, }, }, "range": Array [ - 9, - 10, + 13, + 14, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 14, "line": 1, }, }, "range": Array [ - 11, - 17, + 14, + 15, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -114436,21 +116416,21 @@ Object { "line": 1, }, "start": Object { - "column": 17, + "column": 16, "line": 1, }, }, "range": Array [ - 17, + 16, 18, ], "type": "Punctuator", - "value": ",", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 23, "line": 1, }, "start": Object { @@ -114460,51 +116440,15 @@ Object { }, "range": Array [ 19, - 20, - ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": "?", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, + 23, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 24, "line": 1, }, "start": Object { @@ -114514,358 +116458,195 @@ Object { }, "range": Array [ 23, - 29, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, + 24, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 25, "line": 1, }, "start": Object { - "column": 31, + "column": 24, "line": 1, }, }, "range": Array [ - 31, - 33, + 24, + 25, ], "type": "Punctuator", - "value": "=>", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/function-with-array-destruction.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", }, - "range": Array [ - 34, - 38, - ], - "type": "Keyword", - "value": "void", - }, - Object { "loc": Object { "end": Object { - "column": 39, + "column": 28, "line": 1, }, "start": Object { - "column": 38, + "column": 0, "line": 1, }, }, "range": Array [ - 38, - 39, + 0, + 28, ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/function-generic.src 1`] = ` -Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + ], "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, - "name": "f", "range": Array [ - 4, - 21, + 12, + 20, ], - "type": "Identifier", + "type": "ArrayPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 5, + "column": 15, "line": 1, }, }, "range": Array [ - 5, - 21, + 15, + 20, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 7, + "column": 17, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 11, - 15, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 15, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - }, - }, - }, - ], "range": Array [ - 7, - 21, + 17, + 20, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 21, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, - }, - }, - "type": "TSFunctionType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - "range": Array [ - 8, - 9, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 7, - 10, - ], - "type": "TSTypeParameterDeclaration", - }, + "type": "TSAnyKeyword", }, }, }, - "init": null, + ], + "range": Array [ + 11, + 28, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 21, + "column": 28, "line": 1, }, "start": Object { - "column": 4, + "column": 22, "line": 1, }, }, "range": Array [ - 4, - 21, + 22, + 28, ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, + }, + "type": "TSFunctionType", + }, }, ], "comments": Array [], @@ -114881,14 +116662,14 @@ Object { }, "range": Array [ 0, - 23, + 29, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { @@ -114898,33 +116679,15 @@ Object { }, "range": Array [ 0, - 3, - ], - "type": "Keyword", - "value": "let", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ 4, - 5, ], "type": "Identifier", - "value": "f", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -114934,46 +116697,10 @@ Object { }, "range": Array [ 5, - 6, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ 8, - 9, ], "type": "Identifier", - "value": "T", + "value": "foo", }, Object { "loc": Object { @@ -114991,22 +116718,22 @@ Object { 10, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 1, }, "start": Object { - "column": 10, + "column": 11, "line": 1, }, }, "range": Array [ - 10, 11, + 12, ], "type": "Punctuator", "value": "(", @@ -115014,38 +116741,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, "range": Array [ - 11, 12, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -115062,8 +116789,8 @@ Object { 14, 15, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { @@ -115081,12 +116808,12 @@ Object { 16, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 1, }, "start": Object { @@ -115096,10 +116823,10 @@ Object { }, "range": Array [ 17, - 19, + 20, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { @@ -115116,213 +116843,250 @@ Object { 20, 21, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 24, "line": 1, }, "start": Object { - "column": 21, + "column": 22, "line": 1, }, }, "range": Array [ - 21, 22, + 24, ], "type": "Punctuator", - "value": ";", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "any", }, ], "type": "Program", } `; -exports[`typescript fixtures/types/function-in-generic.src 1`] = ` +exports[`typescript fixtures/types/function-with-object-destruction.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 24, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, - "name": "x", - "range": Array [ - 4, - 24, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", }, - }, - "range": Array [ - 5, - 24, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "kind": "init", "loc": Object { "end": Object { - "column": 24, + "column": 14, "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, + "method": false, "range": Array [ - 7, - 24, + 13, + 14, ], - "type": "TSTypeReference", - "typeName": Object { + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, - "name": "Array", + "name": "a", "range": Array [ - 7, - 12, + 13, + 14, ], "type": "Identifier", }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 13, - 23, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 23, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 23, - ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSFunctionType", - }, - ], - "range": Array [ - 12, - 24, - ], - "type": "TSTypeParameterInstantiation", }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", }, }, }, - "init": null, + ], + "range": Array [ + 11, + 28, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 24, + "column": 28, "line": 1, }, "start": Object { - "column": 4, + "column": 22, "line": 1, }, }, "range": Array [ - 4, - 24, + 22, + 28, ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, }, + "type": "TSFunctionType", }, - "range": Array [ - 0, - 25, - ], - "type": "VariableDeclaration", }, ], "comments": Array [], @@ -115338,14 +117102,14 @@ Object { }, "range": Array [ 0, - 26, + 29, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { @@ -115355,46 +117119,46 @@ Object { }, "range": Array [ 0, - 3, + 4, ], - "type": "Keyword", - "value": "let", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 5, "line": 1, }, }, "range": Array [ - 4, 5, + 8, ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 6, + 9, + 10, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { @@ -115403,16 +117167,16 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 11, "line": 1, }, }, "range": Array [ - 7, + 11, 12, ], - "type": "Identifier", - "value": "Array", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -115430,7 +117194,7 @@ Object { 13, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { @@ -115447,8 +117211,8 @@ Object { 13, 14, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -115466,43 +117230,61 @@ Object { 15, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, "range": Array [ + 15, 16, - 18, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 20, "line": 1, }, "start": Object { - "column": 19, + "column": 17, "line": 1, }, }, "range": Array [ - 19, - 23, + 17, + 20, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -115511,34 +117293,34 @@ Object { "line": 1, }, "start": Object { - "column": 23, + "column": 22, "line": 1, }, }, "range": Array [ - 23, + 22, 24, ], "type": "Punctuator", - "value": ">", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 28, "line": 1, }, "start": Object { - "column": 24, + "column": 25, "line": 1, }, }, "range": Array [ - 24, 25, + 28, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "any", }, ], "type": "Program", diff --git a/packages/shared-fixtures/fixtures/typescript/basics/function-anonymus-with-type-parameters.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-anonymus-with-type-parameters.src.ts new file mode 100644 index 00000000000..44c7468b366 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/function-anonymus-with-type-parameters.src.ts @@ -0,0 +1,3 @@ +var obj = function (a: string) { + return a; +}; diff --git a/packages/shared-fixtures/fixtures/typescript/basics/function-anynomus-with-return-type.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/function-anynomus-with-return-type.src.ts new file mode 100644 index 00000000000..a5d4544e0b1 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/function-anynomus-with-return-type.src.ts @@ -0,0 +1,2 @@ +var obj = function (): void { +}; diff --git a/packages/shared-fixtures/fixtures/typescript/types/function-with-array-destruction.src.ts b/packages/shared-fixtures/fixtures/typescript/types/function-with-array-destruction.src.ts new file mode 100644 index 00000000000..2517be450da --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/function-with-array-destruction.src.ts @@ -0,0 +1 @@ +type foo = ([a]: any) => any diff --git a/packages/shared-fixtures/fixtures/typescript/types/function-with-object-destruction.src.ts b/packages/shared-fixtures/fixtures/typescript/types/function-with-object-destruction.src.ts new file mode 100644 index 00000000000..fdb44b90178 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/function-with-object-destruction.src.ts @@ -0,0 +1 @@ +type foo = ({a}: any) => any diff --git a/packages/typescript-estree/src/semantic-errors.ts b/packages/typescript-estree/src/semantic-errors.ts index 169031947d3..f563e404464 100644 --- a/packages/typescript-estree/src/semantic-errors.ts +++ b/packages/typescript-estree/src/semantic-errors.ts @@ -66,6 +66,8 @@ function whitelistSupportedDiagnostics( case 1090: // ts 3.2 "'{0}' modifier cannot appear on a parameter." case 1096: // ts 3.2 "An index signature must have exactly one parameter." case 1097: // ts 3.2 "'{0}' list cannot be empty." + case 1098: // ts 3.3 "Type parameter list cannot be empty." + case 1099: // ts 3.3 "Type argument list cannot be empty." case 1117: // ts 3.2 "An object literal cannot have multiple properties with the same name in strict mode." case 1121: // ts 3.2 "Octal literals are not allowed in strict mode." case 1123: // ts 3.2: "Variable declaration list cannot be empty." diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index 564a5ab6a1a..8fc5d6acd68 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -383,8 +383,8 @@ tester.addFixturePatternConfig('typescript/basics', { */ 'type-assertion-arrow-function', /** - * Babel does not include optional keyword into range parameter in arrow function - * https://github.com/babel/babel/issues/9461 + * PR for optional parameters in arrow function has been merged into Babel: https://github.com/babel/babel/pull/9463 + * TODO: remove me in next babel > 7.3.2 */ 'arrow-function-with-optional-parameter' ], @@ -434,7 +434,23 @@ tester.addFixturePatternConfig('typescript/expressions', { }); tester.addFixturePatternConfig('typescript/errorRecovery', { - fileType: 'ts' + fileType: 'ts', + ignore: [ + /** + * Expected error on empty type arguments and type parameters + * TypeScript report diagnostics correctly but babel not + * https://github.com/babel/babel/issues/9462 + */ + 'empty-type-arguments', + 'empty-type-arguments-in-call-expression', + 'empty-type-arguments-in-new-expression', + 'empty-type-parameters', + 'empty-type-parameters-in-arrow-function', + 'empty-type-parameters-in-constructor', + 'empty-type-parameters-in-function-expression', + 'empty-type-parameters-in-method', + 'empty-type-parameters-in-method-signature' + ] }); tester.addFixturePatternConfig('typescript/types', { @@ -443,7 +459,11 @@ tester.addFixturePatternConfig('typescript/types', { /** * AST difference */ - 'literal-number-negative' + 'literal-number-negative', + /** + * Babel parse error: https://github.com/babel/babel/pull/9431 + */ + 'function-with-array-destruction' ] }); diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap index 45c5544625e..bfbda114841 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap @@ -1798,6 +1798,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-type-function-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-anonymus-with-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-anynomus-with-return-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-overloads.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/function-with-await.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2073,23 +2077,86 @@ Object { } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments.src 1`] = ` +Object { + "column": 14, + "index": 14, + "lineNumber": 1, + "message": "Type argument list cannot be empty.", +} +`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src 1`] = ` +Object { + "column": 3, + "index": 3, + "lineNumber": 1, + "message": "Type argument list cannot be empty.", +} +`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src 1`] = ` +Object { + "column": 7, + "index": 7, + "lineNumber": 1, + "message": "Type argument list cannot be empty.", +} +`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters.src 1`] = ` +Object { + "column": 11, + "index": 11, + "lineNumber": 1, + "message": "Type parameter list cannot be empty.", +} +`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src 1`] = ` +Object { + "column": 11, + "index": 11, + "lineNumber": 1, + "message": "Type parameter list cannot be empty.", +} +`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src 1`] = ` +Object { + "column": 13, + "index": 25, + "lineNumber": 2, + "message": "Type parameter list cannot be empty.", +} +`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src 1`] = ` +Object { + "column": 20, + "index": 20, + "lineNumber": 1, + "message": "Type parameter list cannot be empty.", +} +`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src 1`] = ` +Object { + "column": 6, + "index": 18, + "lineNumber": 2, + "message": "Type parameter list cannot be empty.", +} +`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src 1`] = ` +Object { + "column": 6, + "index": 22, + "lineNumber": 2, + "message": "Type parameter list cannot be empty.", +} +`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/enum-with-keywords.src 1`] = ` Object { @@ -2360,6 +2427,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-in-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-array-destruction.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-object-destruction.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-rest.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/function-with-this.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index 9c0094cff37..b9e876c4595 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -39177,139 +39177,268 @@ Object { } `; -exports[`typescript fixtures/basics/function-overloads.src 1`] = ` +exports[`typescript fixtures/basics/function-anonymus-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "async": false, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "f", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "params": Array [ - Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 27, + "column": 7, "line": 1, }, "start": Object { - "column": 18, + "column": 4, "line": 1, }, }, - "name": "x", + "name": "obj", "range": Array [ - 18, - 27, + 4, + 7, ], "type": "Identifier", - "typeAnnotation": Object { + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 38, + 47, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 19, + "column": 34, "line": 1, }, }, "range": Array [ - 19, - 27, + 34, + 49, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 27, + "column": 32, "line": 1, }, "start": Object { - "column": 21, + "column": 23, "line": 1, }, }, + "name": "a", "range": Array [ - 21, - 27, + 23, + 32, ], - "type": "TSNumberKeyword", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 10, + 49, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "range": Array [ + 20, + 21, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 19, + 22, + ], + "type": "TSTypeParameterDeclaration", }, }, - ], - "range": Array [ - 7, - 37, - ], - "returnType": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 28, + "column": 4, "line": 1, }, }, "range": Array [ - 28, - 36, + 4, + 49, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "TSNumberKeyword", - }, + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, - "type": "TSDeclareFunction", }, + "range": Array [ + 0, + 50, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { "loc": Object { "end": Object { - "column": 37, + "column": 3, "line": 1, }, "start": Object { @@ -39319,513 +39448,133 @@ Object { }, "range": Array [ 0, - 37, + 3, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "Keyword", + "value": "var", }, Object { - "declaration": Object { - "async": false, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "f", - "range": Array [ - 54, - 55, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, + "start": Object { + "column": 4, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 56, - 65, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 57, - 65, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 59, - 65, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], - "range": Array [ - 45, - 75, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "range": Array [ - 66, - 74, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 68, - 74, - ], - "type": "TSStringKeyword", - }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, }, - "type": "TSDeclareFunction", }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 38, - 75, + 10, + 18, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "Keyword", + "value": "function", }, - Object { - "declaration": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "name": "x", - "range": Array [ - 142, - 143, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 135, - 144, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 55, - "line": 3, - }, - }, - "range": Array [ - 131, - 146, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "name": "f", - "range": Array [ - 92, - 93, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "name": "x", - "range": Array [ - 94, - 112, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 3, - }, - }, - "range": Array [ - 95, - 112, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 112, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 103, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "range": Array [ - 106, - 112, - ], - "type": "TSNumberKeyword", - }, - ], - }, - }, - }, - ], - "range": Array [ - 83, - 146, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 37, - "line": 3, - }, - }, - "range": Array [ - 113, - 130, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 39, - "line": 3, - }, - }, - "range": Array [ - 115, - 130, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 3, - }, - "start": Object { - "column": 39, - "line": 3, - }, - }, - "range": Array [ - 115, - 121, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 48, - "line": 3, - }, - }, - "range": Array [ - 124, - 130, - ], - "type": "TSNumberKeyword", - }, - ], - }, - }, - "type": "FunctionDeclaration", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 76, - 146, - ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 147, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 20, "line": 1, }, "start": Object { - "column": 0, + "column": 19, "line": 1, }, }, "range": Array [ - 0, - 6, + 19, + 20, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 21, "line": 1, }, "start": Object { - "column": 7, + "column": 20, "line": 1, }, }, "range": Array [ - 7, - 15, + 20, + 21, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 22, "line": 1, }, "start": Object { - "column": 16, + "column": 21, "line": 1, }, }, "range": Array [ - 16, - 17, + 21, + 22, ], - "type": "Identifier", - "value": "f", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 23, "line": 1, }, "start": Object { - "column": 17, + "column": 22, "line": 1, }, }, "range": Array [ - 17, - 18, + 22, + 23, ], "type": "Punctuator", "value": "(", @@ -39833,35 +39582,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 24, "line": 1, }, "start": Object { - "column": 18, + "column": 23, "line": 1, }, }, "range": Array [ - 18, - 19, + 23, + 24, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 25, "line": 1, }, "start": Object { - "column": 19, + "column": 24, "line": 1, }, }, "range": Array [ - 19, - 20, + 24, + 25, ], "type": "Punctuator", "value": ":", @@ -39869,35 +39618,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 32, "line": 1, }, "start": Object { - "column": 21, + "column": 26, "line": 1, }, }, "range": Array [ - 21, - 27, + 26, + 32, ], "type": "Identifier", - "value": "number", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 33, "line": 1, }, "start": Object { - "column": 27, + "column": 32, "line": 1, }, }, "range": Array [ - 27, - 28, + 32, + 33, ], "type": "Punctuator", "value": ")", @@ -39905,65 +39654,29 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, + "column": 35, "line": 1, }, "start": Object { - "column": 36, + "column": 34, "line": 1, }, }, "range": Array [ - 36, - 37, + 34, + 35, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 2, }, "start": Object { - "column": 0, + "column": 2, "line": 2, }, }, @@ -39972,364 +39685,338 @@ Object { 44, ], "type": "Keyword", - "value": "export", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 2, }, "start": Object { - "column": 7, + "column": 9, "line": 2, }, }, "range": Array [ 45, - 53, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 54, - 55, - ], - "type": "Identifier", - "value": "f", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 55, - 56, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 56, - 57, + 46, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 11, "line": 2, }, "start": Object { - "column": 19, + "column": 10, "line": 2, }, }, "range": Array [ - 57, - 58, + 46, + 47, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 59, - 65, - ], - "type": "Identifier", - "value": "string", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 27, - "line": 2, + "column": 0, + "line": 3, }, }, "range": Array [ - 65, - 66, + 48, + 49, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 2, + "line": 3, }, "start": Object { - "column": 28, - "line": 2, + "column": 1, + "line": 3, }, }, "range": Array [ - 66, - 67, + 49, + 50, ], "type": "Punctuator", - "value": ":", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-anynomus-with-return-type.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 31, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 68, - 74, ], - "type": "Identifier", - "value": "string", - }, - Object { + "kind": "var", "loc": Object { "end": Object { - "column": 37, + "column": 2, "line": 2, }, "start": Object { - "column": 36, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 74, - 75, + 0, + 32, ], - "type": "Punctuator", - "value": ";", + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 3, + "line": 1, }, "start": Object { "column": 0, - "line": 3, + "line": 1, }, }, "range": Array [ - 76, - 82, + 0, + 3, ], "type": "Keyword", - "value": "export", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { "column": 7, - "line": 3, - }, - }, - "range": Array [ - 83, - 91, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, + "line": 1, }, "start": Object { - "column": 16, - "line": 3, + "column": 4, + "line": 1, }, }, "range": Array [ - 92, - 93, + 4, + 7, ], "type": "Identifier", - "value": "f", + "value": "obj", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 9, + "line": 1, }, "start": Object { - "column": 17, - "line": 3, + "column": 8, + "line": 1, }, }, "range": Array [ - 93, - 94, + 8, + 9, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 10, + "line": 1, }, }, "range": Array [ - 94, - 95, + 10, + 18, ], - "type": "Identifier", - "value": "x", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { "column": 20, - "line": 3, + "line": 1, }, "start": Object { "column": 19, - "line": 3, + "line": 1, }, }, "range": Array [ - 95, - 96, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { "column": 21, - "line": 3, - }, - }, - "range": Array [ - 97, - 103, - ], - "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 3, - }, - }, - "range": Array [ - 104, - 105, - ], - "type": "Punctuator", - "value": "|", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "range": Array [ - 106, - 112, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 3, + "line": 1, }, "start": Object { - "column": 36, - "line": 3, + "column": 20, + "line": 1, }, }, "range": Array [ - 112, - 113, + 20, + 21, ], "type": "Punctuator", "value": ")", @@ -40337,17 +40024,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 37, - "line": 3, + "column": 21, + "line": 1, }, }, "range": Array [ - 113, - 114, + 21, + 22, ], "type": "Punctuator", "value": ":", @@ -40355,216 +40042,1468 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, - "line": 3, + "column": 27, + "line": 1, }, "start": Object { - "column": 39, - "line": 3, + "column": 23, + "line": 1, }, }, "range": Array [ - 115, - 121, + 23, + 27, ], - "type": "Identifier", - "value": "string", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 3, + "column": 29, + "line": 1, }, "start": Object { - "column": 46, - "line": 3, + "column": 28, + "line": 1, }, }, "range": Array [ - 122, - 123, + 28, + 29, ], "type": "Punctuator", - "value": "|", - }, - Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 3, - }, - "start": Object { - "column": 48, - "line": 3, - }, - }, - "range": Array [ - 124, - 130, - ], - "type": "Identifier", - "value": "number", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 56, - "line": 3, + "column": 1, + "line": 2, }, "start": Object { - "column": 55, - "line": 3, + "column": 0, + "line": 2, }, }, "range": Array [ - 131, - 132, + 30, + 31, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { "column": 2, - "line": 4, - }, - }, - "range": Array [ - 135, - 141, - ], - "type": "Keyword", - "value": "return", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "range": Array [ - 142, - 143, - ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 4, + "line": 2, }, "start": Object { - "column": 10, - "line": 4, - }, - }, - "range": Array [ - 143, - 144, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, + "line": 2, }, }, "range": Array [ - 145, - 146, + 31, + 32, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/function-with-await.src 1`] = ` +exports[`typescript fixtures/basics/function-overloads.src 1`] = ` Object { "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "name": "future", - "range": Array [ - 40, - 46, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 34, - 46, - ], - "type": "AwaitExpression", + "declaration": Object { + "async": false, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "start": Object { + "column": 16, + "line": 1, }, - "range": Array [ - 34, - 47, - ], - "type": "ExpressionStatement", }, - ], + "name": "f", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 37, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 18, + 27, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 7, + 37, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "TSDeclareFunction", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "declaration": Object { + "async": false, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "f", + "range": Array [ + 54, + 55, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 56, + 65, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 57, + 65, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 45, + 75, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 66, + 74, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSDeclareFunction", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 75, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "x", + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 135, + 144, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 55, + "line": 3, + }, + }, + "range": Array [ + 131, + 146, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "f", + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 94, + 112, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 95, + 112, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 112, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 103, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 106, + 112, + ], + "type": "TSNumberKeyword", + }, + ], + }, + }, + }, + ], + "range": Array [ + 83, + 146, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 113, + 130, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 130, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 121, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "TSNumberKeyword", + }, + ], + }, + }, + "type": "FunctionDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 146, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 147, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 45, + 53, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 83, + 91, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 103, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 106, + 112, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 121, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 3, + }, + "start": Object { + "column": 55, + "line": 3, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-await.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "future", + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 46, + ], + "type": "AwaitExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 47, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, "start": Object { "column": 28, @@ -106491,131 +107430,563 @@ Object { "line": 1, }, }, - "range": Array [ - 9, - 231, - ], - "type": "TSModuleBlock", + "range": Array [ + 9, + 231, + ], + "type": "TSModuleBlock", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 31, + 44, + ], + "type": "String", + "value": "'hello world'", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "range": Array [ + 49, + 55, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, }, - "name": "A", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", }, + "range": Array [ + 56, + 61, + ], + "type": "Keyword", + "value": "class", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 12, + "column": 22, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 4, }, }, "range": Array [ - 0, - 231, + 62, + 67, ], - "type": "TSModuleDeclaration", + "type": "Identifier", + "value": "Point", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 12, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 89, + ], + "type": "Identifier", + "value": "constructor", }, - }, - "range": Array [ - 0, - 231, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 20, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 19, + "line": 5, }, }, "range": Array [ - 0, - 6, + 89, + 90, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 90, + 96, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 27, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, ], "type": "Identifier", - "value": "module", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 29, + "line": 5, }, "start": Object { - "column": 7, - "line": 1, + "column": 28, + "line": 5, }, }, "range": Array [ - 7, - 8, + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 100, + 106, ], "type": "Identifier", - "value": "A", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 37, + "line": 5, }, "start": Object { - "column": 9, - "line": 1, + "column": 36, + "line": 5, }, }, "range": Array [ - 9, - 10, + 106, + 107, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 108, + 114, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 46, + "line": 5, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 126, + 127, ], "type": "Punctuator", "value": "{", }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 58, + "line": 5, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "}", + }, Object { "loc": Object { "end": Object { "column": 10, - "line": 3, + "line": 7, }, "start": Object { "column": 4, - "line": 3, + "line": 7, }, }, "range": Array [ - 16, - 22, + 140, + 146, ], "type": "Keyword", "value": "export", @@ -106623,593 +107994,932 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 17, + "line": 7, }, "start": Object { "column": 11, - "line": 3, + "line": 7, }, }, "range": Array [ - 23, - 26, + 147, + 153, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 166, + 172, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 173, + 182, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 8, + }, + "start": Object { + "column": 25, + "line": 8, + }, + }, + "range": Array [ + 183, + 185, + ], + "type": "Identifier", + "value": "Id", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 8, + }, + "start": Object { + "column": 28, + "line": 8, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 200, + 204, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 24, + "line": 9, }, "start": Object { - "column": 15, - "line": 3, + "column": 18, + "line": 9, }, }, "range": Array [ - 27, - 28, + 206, + 212, ], "type": "Identifier", - "value": "x", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 9, }, "start": Object { - "column": 17, - "line": 3, + "column": 24, + "line": 9, }, }, "range": Array [ - 29, - 30, + 212, + 213, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, + "column": 9, + "line": 10, }, "start": Object { - "column": 19, - "line": 3, + "column": 8, + "line": 10, }, }, "range": Array [ - 31, - 44, + 222, + 223, ], - "type": "String", - "value": "'hello world'", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 5, + "line": 11, }, "start": Object { "column": 4, - "line": 4, + "line": 11, }, }, "range": Array [ - 49, - 55, + 228, + 229, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 1, + "line": 12, }, "start": Object { - "column": 11, - "line": 4, + "column": 0, + "line": 12, }, }, "range": Array [ - 56, - 61, + 230, + 231, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = ` +Object { + "body": Array [ Object { + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 31, + ], + "raw": "\\"hot-new-module\\"", + "type": "Literal", + "value": "hot-new-module", + }, "loc": Object { "end": Object { - "column": 22, - "line": 4, + "column": 32, + "line": 1, }, "start": Object { - "column": 17, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 62, - 67, + 0, + 32, ], - "type": "Identifier", - "value": "Point", + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 7, + "line": 1, }, "start": Object { - "column": 23, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 68, - 69, + 0, + 7, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 5, + "column": 14, + "line": 1, }, "start": Object { "column": 8, - "line": 5, + "line": 1, }, }, "range": Array [ - 78, - 89, + 8, + 14, ], "type": "Identifier", - "value": "constructor", + "value": "module", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 5, + "column": 31, + "line": 1, }, "start": Object { - "column": 19, - "line": 5, + "column": 15, + "line": 1, }, }, "range": Array [ - 89, - 90, + 15, + 31, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "\\"hot-new-module\\"", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 5, + "column": 32, + "line": 1, }, "start": Object { - "column": 20, - "line": 5, + "column": 31, + "line": 1, }, }, "range": Array [ - 90, - 96, + 31, + 32, ], - "type": "Keyword", - "value": "public", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/array-type.src 1`] = ` +Object { + "body": Array [ Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 28, - "line": 5, + "column": 19, + "line": 1, }, "start": Object { - "column": 27, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 97, - 98, + 0, + 19, ], - "type": "Identifier", - "value": "x", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "TSArrayType", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 29, - "line": 5, + "column": 4, + "line": 1, }, "start": Object { - "column": 28, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 98, - 99, + 0, + 4, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 5, + "column": 8, + "line": 1, }, "start": Object { - "column": 30, - "line": 5, + "column": 5, + "line": 1, }, }, "range": Array [ - 100, - 106, + 5, + 8, ], "type": "Identifier", - "value": "number", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 5, + "column": 10, + "line": 1, }, "start": Object { - "column": 36, - "line": 5, + "column": 9, + "line": 1, }, }, "range": Array [ - 106, - 107, + 9, + 10, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 5, + "column": 17, + "line": 1, }, "start": Object { - "column": 38, - "line": 5, + "column": 11, + "line": 1, }, }, "range": Array [ - 108, - 114, + 11, + 17, ], - "type": "Keyword", - "value": "public", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 5, + "column": 18, + "line": 1, }, "start": Object { - "column": 45, - "line": 5, + "column": 17, + "line": 1, }, }, "range": Array [ - 115, - 116, + 17, + 18, ], - "type": "Identifier", - "value": "y", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 5, + "column": 19, + "line": 1, }, "start": Object { - "column": 46, - "line": 5, + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/conditional.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "TSNumberKeyword", + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 47, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSBooleanKeyword", + }, + "type": "TSConditionalType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 116, - 117, ], - "type": "Punctuator", - "value": ":", - }, - Object { + "kind": "let", "loc": Object { "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { "column": 48, - "line": 5, - }, - }, - "range": Array [ - 118, - 124, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 55, - "line": 5, + "line": 1, }, "start": Object { - "column": 54, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 124, - 125, + 0, + 48, ], - "type": "Punctuator", - "value": ")", + "type": "VariableDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 5, - }, - "start": Object { - "column": 56, - "line": 5, - }, - }, - "range": Array [ - 126, - 127, - ], - "type": "Punctuator", - "value": "{", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, - Object { - "loc": Object { - "end": Object { - "column": 59, - "line": 5, - }, - "start": Object { - "column": 58, - "line": 5, - }, - }, - "range": Array [ - 128, - 129, - ], - "type": "Punctuator", - "value": "}", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 3, + "line": 1, }, "start": Object { - "column": 4, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 134, - 135, + 0, + 3, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 7, + "column": 5, + "line": 1, }, "start": Object { "column": 4, - "line": 7, + "line": 1, }, }, "range": Array [ - 140, - 146, + 4, + 5, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 7, + "column": 6, + "line": 1, }, "start": Object { - "column": 11, - "line": 7, + "column": 5, + "line": 1, }, }, "range": Array [ - 147, - 153, + 5, + 6, ], - "type": "Identifier", - "value": "module", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 7, + "column": 13, + "line": 1, }, "start": Object { - "column": 18, - "line": 7, + "column": 7, + "line": 1, }, }, "range": Array [ - 154, - 155, + 7, + 13, ], "type": "Identifier", - "value": "B", + "value": "number", }, Object { "loc": Object { "end": Object { "column": 21, - "line": 7, + "line": 1, }, "start": Object { - "column": 20, - "line": 7, - }, - }, - "range": Array [ - 156, - 157, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { "column": 14, - "line": 8, - }, - "start": Object { - "column": 8, - "line": 8, - }, - }, - "range": Array [ - 166, - 172, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 8, - }, - "start": Object { - "column": 15, - "line": 8, + "line": 1, }, }, "range": Array [ - 173, - 182, + 14, + 21, ], "type": "Keyword", - "value": "interface", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 8, + "column": 28, + "line": 1, }, "start": Object { - "column": 25, - "line": 8, + "column": 22, + "line": 1, }, }, "range": Array [ - 183, - 185, + 22, + 28, ], "type": "Identifier", - "value": "Id", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 8, + "column": 30, + "line": 1, }, "start": Object { - "column": 28, - "line": 8, + "column": 29, + "line": 1, }, }, "range": Array [ - 186, - 187, + 29, + 30, ], "type": "Punctuator", - "value": "{", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 9, + "column": 38, + "line": 1, }, "start": Object { - "column": 12, - "line": 9, + "column": 31, + "line": 1, }, }, "range": Array [ - 200, - 204, + 31, + 38, ], "type": "Identifier", - "value": "name", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 9, + "column": 40, + "line": 1, }, "start": Object { - "column": 16, - "line": 9, + "column": 39, + "line": 1, }, }, "range": Array [ - 204, - 205, + 39, + 40, ], "type": "Punctuator", "value": ":", @@ -107217,17 +108927,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, - "line": 9, + "column": 47, + "line": 1, }, "start": Object { - "column": 18, - "line": 9, + "column": 41, + "line": 1, }, }, "range": Array [ - 206, - 212, + 41, + 47, ], "type": "Identifier", "value": "string", @@ -107235,141 +108945,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 9, + "column": 48, + "line": 1, }, "start": Object { - "column": 24, - "line": 9, + "column": 47, + "line": 1, }, }, "range": Array [ - 212, - 213, + 47, + 48, ], "type": "Punctuator", "value": ";", }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 10, - }, - "start": Object { - "column": 8, - "line": 10, - }, - }, - "range": Array [ - 222, - 223, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 11, - }, - "start": Object { - "column": 4, - "line": 11, - }, - }, - "range": Array [ - 228, - 229, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 12, - }, - "start": Object { - "column": 0, - "line": 12, - }, - }, - "range": Array [ - 230, - 231, - ], - "type": "Punctuator", - "value": "}", - }, ], "type": "Program", } `; -exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer.src 1`] = ` Object { "body": Array [ Object { - "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 31, + "column": 12, "line": 1, }, "start": Object { - "column": 15, + "column": 5, "line": 1, }, }, + "name": "Element", "range": Array [ - 15, - 31, + 5, + 12, ], - "raw": "\\"hot-new-module\\"", - "type": "Literal", - "value": "hot-new-module", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "type": "Identifier", }, - "range": Array [ - 0, - 32, - ], - "type": "TSModuleDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 33, - ], - "sourceType": "script", - "tokens": Array [ - Object { "loc": Object { "end": Object { - "column": 7, + "column": 48, "line": 1, }, "start": Object { @@ -107379,140 +108999,270 @@ Object { }, "range": Array [ 0, - 7, - ], - "type": "Identifier", - "value": "declare", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 14, + 48, ], - "type": "Identifier", - "value": "module", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, }, - }, - "range": Array [ - 15, - 31, - ], - "type": "String", - "value": "\\"hot-new-module\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, + "extendsType": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 37, + ], + "type": "TSParenthesizedType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 39, + ], + "type": "TSArrayType", }, - "start": Object { - "column": 31, - "line": 1, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + }, }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/array-type.src 1`] = ` -Object { - "body": Array [ - Object { - "id": Object { "loc": Object { "end": Object { - "column": 8, + "column": 47, "line": 1, }, "start": Object { - "column": 5, + "column": 18, "line": 1, }, }, - "name": "Foo", "range": Array [ - 5, - 8, + 18, + 47, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 19, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "elementType": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 17, + "column": 43, "line": 1, }, "start": Object { - "column": 11, + "column": 42, "line": 1, }, }, "range": Array [ - 11, - 17, + 42, + 43, ], - "type": "TSStringKeyword", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, }, + "type": "TSConditionalType", + }, + "typeParameters": Object { "loc": Object { "end": Object { - "column": 19, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 14, + ], + "type": "TSTypeParameter", + }, + ], "range": Array [ - 11, - 19, + 12, + 15, ], - "type": "TSArrayType", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -107528,7 +109278,7 @@ Object { }, "range": Array [ 0, - 20, + 49, ], "sourceType": "script", "tokens": Array [ @@ -107553,7 +109303,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { @@ -107563,64 +109313,82 @@ Object { }, "range": Array [ 5, - 8, + 12, ], "type": "Identifier", - "value": "Foo", + "value": "Element", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 13, "line": 1, }, "start": Object { - "column": 9, + "column": 12, "line": 1, }, }, "range": Array [ - 9, - 10, + 12, + 13, ], "type": "Punctuator", - "value": "=", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 14, "line": 1, }, "start": Object { - "column": 11, + "column": 13, "line": 1, }, }, "range": Array [ - 11, - 17, + 13, + 14, ], "type": "Identifier", - "value": "string", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 15, "line": 1, }, "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { "column": 17, "line": 1, }, + "start": Object { + "column": 16, + "line": 1, + }, }, "range": Array [ + 16, 17, - 18, ], "type": "Punctuator", - "value": "[", + "value": "=", }, Object { "loc": Object { @@ -107637,314 +109405,149 @@ Object { 18, 19, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "T", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/conditional.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 47, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 47, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 13, - ], - "type": "TSNumberKeyword", - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "range": Array [ - 41, - 47, - ], - "type": "TSStringKeyword", - }, - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 47, - ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 38, - ], - "type": "TSBooleanKeyword", - }, - "type": "TSConditionalType", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 47, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", "loc": Object { "end": Object { - "column": 48, + "column": 27, "line": 1, }, "start": Object { - "column": 0, + "column": 20, "line": 1, }, }, "range": Array [ - 0, - 48, + 20, + 27, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "extends", }, - }, - "range": Array [ - 0, - 49, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 29, "line": 1, }, "start": Object { - "column": 0, + "column": 28, "line": 1, }, }, "range": Array [ - 0, - 3, + 28, + 29, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 34, "line": 1, }, "start": Object { - "column": 4, + "column": 29, "line": 1, }, }, "range": Array [ - 4, - 5, + 29, + 34, ], "type": "Identifier", - "value": "x", + "value": "infer", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 36, "line": 1, }, "start": Object { - "column": 5, + "column": 35, "line": 1, }, }, "range": Array [ - 5, - 6, + 35, + 36, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "U", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 37, "line": 1, }, "start": Object { - "column": 7, + "column": 36, "line": 1, }, }, "range": Array [ - 7, - 13, + 36, + 37, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 38, "line": 1, }, "start": Object { - "column": 14, + "column": 37, "line": 1, }, }, "range": Array [ - 14, - 21, + 37, + 38, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 39, "line": 1, }, "start": Object { - "column": 22, + "column": 38, "line": 1, }, }, - "range": Array [ - 22, - 28, + "range": Array [ + 38, + 39, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 41, "line": 1, }, "start": Object { - "column": 29, + "column": 40, "line": 1, }, }, "range": Array [ - 29, - 30, + 40, + 41, ], "type": "Punctuator", "value": "?", @@ -107952,35 +109555,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 43, "line": 1, }, "start": Object { - "column": 31, + "column": 42, "line": 1, }, }, "range": Array [ - 31, - 38, + 42, + 43, ], "type": "Identifier", - "value": "boolean", + "value": "U", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 45, "line": 1, }, "start": Object { - "column": 39, + "column": 44, "line": 1, }, }, "range": Array [ - 39, - 40, + 44, + 45, ], "type": "Punctuator", "value": ":", @@ -107992,16 +109595,16 @@ Object { "line": 1, }, "start": Object { - "column": 41, + "column": 46, "line": 1, }, }, "range": Array [ - 41, + 46, 47, ], "type": "Identifier", - "value": "string", + "value": "T", }, Object { "loc": Object { @@ -108026,14 +109629,14 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer-nested.src 1`] = ` Object { "body": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { @@ -108041,17 +109644,17 @@ Object { "line": 1, }, }, - "name": "Element", + "name": "Unpacked", "range": Array [ 5, - 12, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 10, + "line": 5, }, "start": Object { "column": 0, @@ -108060,41 +109663,41 @@ Object { }, "range": Array [ 0, - 48, + 126, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "checkType": Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 18, - 19, + 21, + 22, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "name": "T", "range": Array [ - 18, - 19, + 21, + 22, ], "type": "Identifier", }, @@ -108103,67 +109706,67 @@ Object { "elementType": Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 37, + 31, + 40, ], "type": "TSParenthesizedType", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 29, - 36, + 32, + 39, ], "type": "TSInferType", "typeParameter": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "name": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "name": "U", "range": Array [ - 35, - 36, + 38, + 39, ], "type": "Identifier", }, "range": Array [ - 35, - 36, + 38, + 39, ], "type": "TSTypeParameter", }, @@ -108171,100 +109774,432 @@ Object { }, "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 39, + 31, + 42, ], "type": "TSArrayType", }, "falseType": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 63, + 70, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + }, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeParameter", + }, + }, + "falseType": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "T", + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + }, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 93, + 109, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "Promise", + "range": Array [ + 93, + 100, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 101, + 108, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + }, + "range": Array [ + 107, + 108, + ], + "type": "TSTypeParameter", + }, + }, + ], + "range": Array [ + 100, + 109, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "T", + "range": Array [ + 124, + 125, + ], + "type": "Identifier", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 125, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + }, + }, + "type": "TSConditionalType", + }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 46, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 46, - 47, + 53, + 125, ], - "type": "TSTypeReference", - "typeName": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 25, + "line": 3, }, "start": Object { - "column": 46, - "line": 1, + "column": 24, + "line": 3, }, }, - "name": "T", "range": Array [ - 46, - 47, + 73, + 74, ], - "type": "Identifier", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + }, }, + "type": "TSConditionalType", }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, - "range": Array [ - 18, - 47, + "range": Array [ + 21, + 125, ], "trueType": Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 42, - 43, + 45, + 46, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "name": "U", "range": Array [ - 42, - 43, + 45, + 46, ], "type": "Identifier", }, @@ -108274,11 +110209,11 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, @@ -108286,42 +110221,42 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "name": Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "name": "T", "range": Array [ - 13, 14, + 15, ], "type": "Identifier", }, "range": Array [ - 13, 14, + 15, ], "type": "TSTypeParameter", }, ], "range": Array [ - 12, - 15, + 13, + 16, ], "type": "TSTypeParameterDeclaration", }, @@ -108330,7 +110265,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 6, }, "start": Object { "column": 0, @@ -108339,7 +110274,7 @@ Object { }, "range": Array [ 0, - 49, + 127, ], "sourceType": "script", "tokens": Array [ @@ -108364,7 +110299,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { @@ -108374,25 +110309,25 @@ Object { }, "range": Array [ 5, - 12, + 13, ], "type": "Identifier", - "value": "Element", + "value": "Unpacked", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], "type": "Punctuator", "value": "<", @@ -108400,17 +110335,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 15, ], "type": "Identifier", "value": "T", @@ -108418,17 +110353,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 14, + "column": 15, "line": 1, }, }, "range": Array [ - 14, 15, + 16, ], "type": "Punctuator", "value": ">", @@ -108436,17 +110371,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 16, + "column": 17, "line": 1, }, }, "range": Array [ - 16, 17, + 18, ], "type": "Punctuator", "value": "=", @@ -108454,17 +110389,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 18, - 19, + 21, + 22, ], "type": "Identifier", "value": "T", @@ -108472,17 +110407,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 20, - 27, + 23, + 30, ], "type": "Keyword", "value": "extends", @@ -108490,17 +110425,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 28, - 29, + 31, + 32, ], "type": "Punctuator", "value": "(", @@ -108508,17 +110443,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 29, - 34, + 32, + 37, ], "type": "Identifier", "value": "infer", @@ -108526,17 +110461,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 35, - 36, + 38, + 39, ], "type": "Identifier", "value": "U", @@ -108544,17 +110479,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 36, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 36, - 37, + 39, + 40, ], "type": "Punctuator", "value": ")", @@ -108562,17 +110497,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 37, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 37, - 38, + 40, + 41, ], "type": "Punctuator", "value": "[", @@ -108580,17 +110515,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 38, - 39, + 41, + 42, ], "type": "Punctuator", "value": "]", @@ -108598,17 +110533,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 25, + "line": 2, }, "start": Object { - "column": 40, - "line": 1, + "column": 24, + "line": 2, }, }, "range": Array [ - 40, - 41, + 43, + 44, ], "type": "Punctuator", "value": "?", @@ -108616,17 +110551,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 42, - 43, + 45, + 46, ], "type": "Identifier", "value": "U", @@ -108634,17 +110569,323 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 44, - "line": 1, + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 55, + 62, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 63, + 68, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 85, + 92, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 93, + 100, + ], + "type": "Identifier", + "value": "Promise", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 37, + "line": 4, }, }, "range": Array [ - 44, - 45, + 114, + 115, ], "type": "Punctuator", "value": ":", @@ -108652,17 +110893,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 46, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 46, - 47, + 124, + 125, ], "type": "Identifier", "value": "T", @@ -108670,17 +110911,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 10, + "line": 5, }, "start": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, }, "range": Array [ - 47, - 48, + 125, + 126, ], "type": "Punctuator", "value": ";", @@ -108690,14 +110931,14 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer-nested.src 1`] = ` +exports[`typescript fixtures/types/conditional-infer-simple.src 1`] = ` Object { "body": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { @@ -108705,17 +110946,17 @@ Object { "line": 1, }, }, - "name": "Unpacked", + "name": "Foo", "range": Array [ 5, - 13, + 8, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 63, + "line": 1, }, "start": Object { "column": 0, @@ -108724,543 +110965,336 @@ Object { }, "range": Array [ 0, - 126, + 63, ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { "checkType": Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 22, + 14, + 15, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "name": "T", "range": Array [ - 21, - 22, + 14, + 15, ], "type": "Identifier", }, }, "extendsType": Object { - "elementType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 40, - ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 32, - 39, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": "U", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "range": Array [ - 38, - 39, - ], - "type": "TSTypeParameter", - }, - }, - }, "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 50, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 42, - ], - "type": "TSArrayType", - }, - "falseType": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "T", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 63, - 70, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "name": "U", - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - }, - "range": Array [ - 69, - 70, - ], - "type": "TSTypeParameter", + "column": 24, + "line": 1, }, }, - "falseType": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 84, - ], - "type": "TSTypeReference", - "typeName": Object { + "members": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 27, + "line": 1, }, "start": Object { - "column": 6, - "line": 4, + "column": 26, + "line": 1, }, }, - "name": "T", + "name": "a", "range": Array [ - 83, - 84, + 26, + 27, ], "type": "Identifier", }, - }, - "extendsType": Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 37, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 26, + "line": 1, }, }, "range": Array [ - 93, - 109, + 26, + 37, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 27, + "line": 1, }, }, - "name": "Promise", "range": Array [ - 93, - 100, + 27, + 36, ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 4, - }, - "start": Object { - "column": 23, - "line": 4, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "range": Array [ + 29, + 36, + ], + "type": "TSInferType", + "typeParameter": Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 24, - "line": 4, + "column": 35, + "line": 1, }, }, - "range": Array [ - 101, - 108, - ], - "type": "TSInferType", - "typeParameter": Object { + "name": Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 30, - "line": 4, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 4, - }, - "start": Object { - "column": 30, - "line": 4, - }, + "column": 35, + "line": 1, }, - "name": "U", - "range": Array [ - 107, - 108, - ], - "type": "Identifier", }, + "name": "U", "range": Array [ - 107, - 108, + 35, + 36, ], - "type": "TSTypeParameter", + "type": "Identifier", }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", }, - ], - "range": Array [ - 100, - 109, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 5, }, }, - "range": Array [ - 124, - 125, - ], - "type": "TSTypeReference", - "typeName": Object { + }, + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 39, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 38, + "line": 1, }, }, - "name": "T", + "name": "b", "range": Array [ - 124, - 125, + 38, + 39, ], "type": "Identifier", }, - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 125, - ], - "trueType": Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 38, + "line": 1, }, }, "range": Array [ - 112, - 113, + 38, + 48, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSPropertySignature", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "TSInferType", + "typeParameter": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "range": Array [ + 47, + 48, + ], + "type": "TSTypeParameter", }, }, - "name": "U", - "range": Array [ - 112, - 113, - ], - "type": "Identifier", }, }, - "type": "TSConditionalType", - }, + ], + "range": Array [ + 24, + 50, + ], + "type": "TSTypeLiteral", + }, + "falseType": Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 57, + "line": 1, }, }, "range": Array [ - 53, - 125, + 57, + 62, ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "range": Array [ - 73, - 74, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "name": "U", - "range": Array [ - 73, - 74, - ], - "type": "Identifier", - }, - }, - "type": "TSConditionalType", + "type": "TSNeverKeyword", }, "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 125, + 14, + 62, ], "trueType": Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 54, + "line": 1, }, "start": Object { - "column": 26, - "line": 2, + "column": 53, + "line": 1, }, }, "range": Array [ - 45, - 46, + 53, + 54, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 54, + "line": 1, }, "start": Object { - "column": 26, - "line": 2, + "column": 53, + "line": 1, }, }, "name": "U", "range": Array [ - 45, - 46, + 53, + 54, ], "type": "Identifier", }, @@ -109270,11 +111304,11 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, @@ -109282,42 +111316,42 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "name": Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "name": "T", "range": Array [ - 14, - 15, + 9, + 10, ], "type": "Identifier", }, "range": Array [ - 14, - 15, + 9, + 10, ], "type": "TSTypeParameter", }, ], "range": Array [ - 13, - 16, + 8, + 11, ], "type": "TSTypeParameterDeclaration", }, @@ -109326,7 +111360,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 2, }, "start": Object { "column": 0, @@ -109335,7 +111369,7 @@ Object { }, "range": Array [ 0, - 127, + 64, ], "sourceType": "script", "tokens": Array [ @@ -109360,7 +111394,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { @@ -109370,25 +111404,25 @@ Object { }, "range": Array [ 5, - 13, + 8, ], "type": "Identifier", - "value": "Unpacked", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 9, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, "range": Array [ - 13, - 14, + 8, + 9, ], "type": "Punctuator", "value": "<", @@ -109396,17 +111430,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 14, + "column": 9, "line": 1, }, }, "range": Array [ - 14, - 15, + 9, + 10, ], "type": "Identifier", "value": "T", @@ -109414,17 +111448,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 15, + "column": 10, "line": 1, }, }, "range": Array [ - 15, - 16, + 10, + 11, ], "type": "Punctuator", "value": ">", @@ -109432,17 +111466,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 13, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 18, + 12, + 13, ], "type": "Punctuator", "value": "=", @@ -109450,17 +111484,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 21, - 22, + 14, + 15, ], "type": "Identifier", "value": "T", @@ -109468,179 +111502,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ + 16, 23, - 30, ], "type": "Keyword", "value": "extends", }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 32, - 37, - ], - "type": "Identifier", - "value": "infer", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - "value": "U", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 40, - 41, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 41, - 42, - ], - "type": "Punctuator", - "value": "]", - }, Object { "loc": Object { "end": Object { "column": 25, - "line": 2, + "line": 1, }, "start": Object { "column": 24, - "line": 2, + "line": 1, }, }, "range": Array [ - 43, - 44, + 24, + 25, ], "type": "Punctuator", - "value": "?", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 27, - "line": 2, + "line": 1, }, "start": Object { "column": 26, - "line": 2, + "line": 1, }, }, "range": Array [ - 45, - 46, + 26, + 27, ], "type": "Identifier", - "value": "U", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { - "column": 28, - "line": 2, + "column": 27, + "line": 1, }, }, "range": Array [ - 47, - 48, + 27, + 28, ], "type": "Punctuator", "value": ":", @@ -109648,53 +111574,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 55, - 62, - ], - "type": "Keyword", - "value": "extends", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, + "column": 34, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 29, + "line": 1, }, }, "range": Array [ - 63, - 68, + 29, + 34, ], "type": "Identifier", "value": "infer", @@ -109702,53 +111592,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - "value": "U", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 22, - "line": 3, - }, - }, - "range": Array [ - 71, - 72, - ], - "type": "Punctuator", - "value": "?", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, + "column": 36, + "line": 1, }, "start": Object { - "column": 24, - "line": 3, + "column": 35, + "line": 1, }, }, "range": Array [ - 73, - 74, + 35, + 36, ], "type": "Identifier", "value": "U", @@ -109756,107 +111610,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 37, + "line": 1, }, "start": Object { - "column": 26, - "line": 3, + "column": 36, + "line": 1, }, }, "range": Array [ - 75, - 76, + 36, + 37, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "range": Array [ - 83, - 84, - ], - "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 85, - 92, - ], - "type": "Keyword", - "value": "extends", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 39, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 38, + "line": 1, }, }, "range": Array [ - 93, - 100, + 38, + 39, ], "type": "Identifier", - "value": "Promise", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 40, + "line": 1, }, "start": Object { - "column": 23, - "line": 4, + "column": 39, + "line": 1, }, }, "range": Array [ - 100, - 101, + 39, + 40, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 4, + "column": 46, + "line": 1, }, "start": Object { - "column": 24, - "line": 4, + "column": 41, + "line": 1, }, }, "range": Array [ - 101, - 106, + 41, + 46, ], "type": "Identifier", "value": "infer", @@ -109864,17 +111682,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, - "line": 4, + "column": 48, + "line": 1, }, "start": Object { - "column": 30, - "line": 4, + "column": 47, + "line": 1, }, }, "range": Array [ - 107, - 108, + 47, + 48, ], "type": "Identifier", "value": "U", @@ -109882,35 +111700,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 50, + "line": 1, }, "start": Object { - "column": 31, - "line": 4, + "column": 49, + "line": 1, }, }, "range": Array [ - 108, - 109, + 49, + 50, ], "type": "Punctuator", - "value": ">", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 4, + "column": 52, + "line": 1, }, "start": Object { - "column": 33, - "line": 4, + "column": 51, + "line": 1, }, }, "range": Array [ - 110, - 111, + 51, + 52, ], "type": "Punctuator", "value": "?", @@ -109918,17 +111736,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 4, + "column": 54, + "line": 1, }, "start": Object { - "column": 35, - "line": 4, + "column": 53, + "line": 1, }, }, "range": Array [ - 112, - 113, + 53, + 54, ], "type": "Identifier", "value": "U", @@ -109936,17 +111754,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 4, + "column": 56, + "line": 1, }, "start": Object { - "column": 37, - "line": 4, + "column": 55, + "line": 1, }, }, "range": Array [ - 114, - 115, + 55, + 56, ], "type": "Punctuator", "value": ":", @@ -109954,35 +111772,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 57, + "line": 1, }, }, "range": Array [ - 124, - 125, + 57, + 62, ], "type": "Identifier", - "value": "T", + "value": "never", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 63, + "line": 1, }, "start": Object { - "column": 9, - "line": 5, + "column": 62, + "line": 1, }, }, "range": Array [ - 125, - 126, + 62, + 63, ], "type": "Punctuator", "value": ";", @@ -109992,430 +111810,166 @@ Object { } `; -exports[`typescript fixtures/types/conditional-infer-simple.src 1`] = ` +exports[`typescript fixtures/types/conditional-with-null.src 1`] = ` Object { "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 63, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 63, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeReference", - "typeName": Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 45, "line": 1, }, "start": Object { - "column": 14, + "column": 4, "line": 1, }, }, - "name": "T", + "name": "x", "range": Array [ - 14, - 15, + 4, + 45, ], "type": "Identifier", - }, - }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 45, "line": 1, }, "start": Object { - "column": 26, + "column": 5, "line": 1, }, }, "range": Array [ - 26, - 37, + 5, + 45, ], - "type": "TSPropertySignature", + "type": "TSTypeAnnotation", "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 36, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "checkType": Object { "loc": Object { "end": Object { - "column": 36, + "column": 13, "line": 1, }, "start": Object { - "column": 29, + "column": 7, "line": 1, }, }, "range": Array [ - 29, - 36, + 7, + 13, ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, + "type": "TSNumberKeyword", + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", + "start": Object { + "column": 22, + "line": 1, }, - "range": Array [ - 35, - 36, - ], - "type": "TSTypeParameter", }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", }, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, }, + "range": Array [ + 41, + 45, + ], + "type": "TSNullKeyword", }, - "name": "b", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 48, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 48, + "column": 45, "line": 1, }, "start": Object { - "column": 39, + "column": 7, "line": 1, }, }, "range": Array [ - 39, - 48, + 7, + 45, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "trueType": Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 41, + "column": 38, "line": 1, - }, - }, - "range": Array [ - 41, - 48, - ], - "type": "TSInferType", - "typeParameter": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 47, - 48, - ], - "type": "Identifier", - }, - "range": Array [ - 47, - 48, - ], - "type": "TSTypeParameter", - }, - }, - }, - }, - ], - "range": Array [ - 24, - 50, - ], - "type": "TSTypeLiteral", - }, - "falseType": Object { - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 57, - "line": 1, - }, - }, - "range": Array [ - 57, - 62, - ], - "type": "TSNeverKeyword", - }, - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 62, - ], - "trueType": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - }, - "type": "TSConditionalType", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSBooleanKeyword", }, + "type": "TSConditionalType", }, - "name": "T", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, - "range": Array [ - 9, - 10, - ], - "type": "TSTypeParameter", }, - ], - "range": Array [ - 8, - 11, - ], - "type": "TSTypeParameterDeclaration", + "init": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", }, ], "loc": Object { @@ -110430,14 +111984,14 @@ Object { }, "range": Array [ 0, - 64, + 47, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 3, "line": 1, }, "start": Object { @@ -110447,15 +112001,33 @@ Object { }, "range": Array [ 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ 4, + 5, ], "type": "Identifier", - "value": "type", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -110465,169 +112037,461 @@ Object { }, "range": Array [ 5, - 8, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, ], "type": "Identifier", - "value": "Foo", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 21, "line": 1, }, "start": Object { - "column": 8, + "column": 14, "line": 1, }, }, "range": Array [ - 8, - 9, + 14, + 21, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 28, "line": 1, }, "start": Object { - "column": 9, + "column": 22, "line": 1, }, }, "range": Array [ - 9, - 10, + 22, + 28, ], "type": "Identifier", - "value": "T", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 30, "line": 1, }, "start": Object { - "column": 10, + "column": 29, "line": 1, }, }, "range": Array [ - 10, - 11, + 29, + 30, ], "type": "Punctuator", - "value": ">", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 38, "line": 1, }, "start": Object { - "column": 12, + "column": 31, "line": 1, }, }, "range": Array [ - 12, - 13, + 31, + 38, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 40, "line": 1, }, "start": Object { - "column": 14, + "column": 39, "line": 1, }, }, "range": Array [ - 14, - 15, + 39, + 40, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 45, "line": 1, }, "start": Object { - "column": 16, + "column": 41, "line": 1, }, }, "range": Array [ - 16, - 23, + 41, + 45, ], "type": "Keyword", - "value": "extends", + "value": "null", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 46, "line": 1, }, "start": Object { - "column": 24, + "column": 45, "line": 1, }, }, "range": Array [ - 24, - 25, + 45, + 46, ], "type": "Punctuator", - "value": "{", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 4, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 23, + 33, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 7, + 42, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSConstructorType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 42, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 27, + "column": 3, "line": 1, }, "start": Object { - "column": 26, + "column": 0, "line": 1, }, }, "range": Array [ - 26, - 27, + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, ], "type": "Identifier", - "value": "a", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 6, "line": 1, }, "start": Object { - "column": 27, + "column": 5, "line": 1, }, }, "range": Array [ - 27, - 28, + 5, + 6, ], "type": "Punctuator", "value": ":", @@ -110635,233 +112499,251 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 10, "line": 1, }, "start": Object { - "column": 29, + "column": 7, "line": 1, }, }, "range": Array [ - 29, - 34, + 7, + 10, ], - "type": "Identifier", - "value": "infer", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 12, "line": 1, }, "start": Object { - "column": 35, + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, "line": 1, }, }, "range": Array [ - 35, - 36, + 12, + 13, ], "type": "Identifier", - "value": "U", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 14, "line": 1, }, "start": Object { - "column": 36, + "column": 13, "line": 1, }, }, "range": Array [ - 36, - 37, + 13, + 14, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 21, "line": 1, }, "start": Object { - "column": 38, + "column": 15, "line": 1, }, }, "range": Array [ - 38, - 39, + 15, + 21, ], "type": "Identifier", - "value": "b", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 22, "line": 1, }, "start": Object { - "column": 39, + "column": 21, "line": 1, }, }, "range": Array [ - 39, - 40, + 21, + 22, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 24, "line": 1, }, "start": Object { - "column": 41, + "column": 23, "line": 1, }, }, "range": Array [ - 41, - 46, + 23, + 24, ], "type": "Identifier", - "value": "infer", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 25, "line": 1, }, "start": Object { - "column": 47, + "column": 24, "line": 1, }, }, "range": Array [ - 47, - 48, + 24, + 25, ], - "type": "Identifier", - "value": "U", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 50, + "column": 26, "line": 1, }, "start": Object { - "column": 49, + "column": 25, "line": 1, }, }, "range": Array [ - 49, - 50, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 52, + "column": 33, "line": 1, }, "start": Object { - "column": 51, + "column": 27, "line": 1, }, }, "range": Array [ - 51, - 52, + 27, + 33, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 54, + "column": 34, "line": 1, }, "start": Object { - "column": 53, + "column": 33, "line": 1, }, }, "range": Array [ - 53, - 54, + 33, + 34, ], - "type": "Identifier", - "value": "U", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 56, + "column": 37, "line": 1, }, "start": Object { - "column": 55, + "column": 35, "line": 1, }, }, "range": Array [ - 55, - 56, + 35, + 37, ], "type": "Punctuator", - "value": ":", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 62, + "column": 42, "line": 1, }, "start": Object { - "column": 57, + "column": 38, "line": 1, }, }, "range": Array [ - 57, - 62, + 38, + 42, ], - "type": "Identifier", - "value": "never", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 63, + "column": 43, "line": 1, }, "start": Object { - "column": 62, + "column": 42, "line": 1, }, }, "range": Array [ - 62, - 63, + 42, + 43, ], "type": "Punctuator", "value": ";", @@ -110871,7 +112753,7 @@ Object { } `; -exports[`typescript fixtures/types/conditional-with-null.src 1`] = ` +exports[`typescript fixtures/types/constructor-generic.src 1`] = ` Object { "body": Array [ Object { @@ -110880,7 +112762,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -110888,16 +112770,16 @@ Object { "line": 1, }, }, - "name": "x", + "name": "f", "range": Array [ 4, - 45, + 25, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -110907,100 +112789,210 @@ Object { }, "range": Array [ 5, - 45, + 25, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { - "checkType": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, }, - "range": Array [ - 7, - 13, - ], - "type": "TSNumberKeyword", }, - "extendsType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, }, - "start": Object { - "column": 22, - "line": 1, + "name": "a", + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + }, }, }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - "falseType": Object { + ], + "range": Array [ + 7, + 25, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { - "column": 41, + "column": 21, "line": 1, }, }, "range": Array [ - 41, - 45, + 21, + 25, ], - "type": "TSNullKeyword", - }, - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + }, }, }, - "range": Array [ - 7, - 45, - ], - "trueType": Object { + "type": "TSConstructorType", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 38, + "column": 14, "line": 1, }, "start": Object { - "column": 31, + "column": 11, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "range": Array [ + 12, + 13, + ], + "type": "TSTypeParameter", + }, + ], "range": Array [ - 31, - 38, + 11, + 14, ], - "type": "TSBooleanKeyword", + "type": "TSTypeParameterDeclaration", }, - "type": "TSConditionalType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 45, + "column": 25, "line": 1, }, "start": Object { @@ -111010,7 +113002,7 @@ Object { }, "range": Array [ 4, - 45, + 25, ], "type": "VariableDeclarator", }, @@ -111018,7 +113010,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 46, + "column": 26, "line": 1, }, "start": Object { @@ -111028,7 +113020,7 @@ Object { }, "range": Array [ 0, - 46, + 26, ], "type": "VariableDeclaration", }, @@ -111045,7 +113037,7 @@ Object { }, "range": Array [ 0, - 47, + 27, ], "sourceType": "script", "tokens": Array [ @@ -111083,7 +113075,7 @@ Object { 5, ], "type": "Identifier", - "value": "x", + "value": "f", }, Object { "loc": Object { @@ -111106,7 +113098,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 1, }, "start": Object { @@ -111116,15 +113108,69 @@ Object { }, "range": Array [ 7, + 10, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, 13, ], "type": "Identifier", - "value": "number", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, "line": 1, }, "start": Object { @@ -111134,115 +113180,133 @@ Object { }, "range": Array [ 14, - 21, + 15, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 16, "line": 1, }, "start": Object { - "column": 22, + "column": 15, "line": 1, }, }, "range": Array [ - 22, - 28, + 15, + 16, ], "type": "Identifier", - "value": "string", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 17, "line": 1, }, "start": Object { - "column": 29, + "column": 16, "line": 1, }, }, "range": Array [ - 29, - 30, + 16, + 17, ], "type": "Punctuator", - "value": "?", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 19, "line": 1, }, "start": Object { - "column": 31, + "column": 18, "line": 1, }, }, "range": Array [ - 31, - 38, + 18, + 19, ], "type": "Identifier", - "value": "boolean", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 20, "line": 1, }, "start": Object { - "column": 39, + "column": 19, "line": 1, }, }, "range": Array [ - 39, - 40, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 45, + "column": 23, "line": 1, }, "start": Object { - "column": 41, + "column": 21, "line": 1, }, }, "range": Array [ - 41, - 45, + 21, + 23, ], - "type": "Keyword", - "value": "null", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 25, "line": 1, }, "start": Object { - "column": 45, + "column": 24, "line": 1, }, }, "range": Array [ - 45, - 46, + 24, + 25, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -111252,7 +113316,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor.src 1`] = ` +exports[`typescript fixtures/types/constructor-in-generic.src 1`] = ` Object { "body": Array [ Object { @@ -111261,7 +113325,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -111269,16 +113333,16 @@ Object { "line": 1, }, }, - "name": "f", + "name": "x", "range": Array [ 4, - 42, + 30, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -111288,13 +113352,13 @@ Object { }, "range": Array [ 5, - 42, + 30, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -111302,28 +113366,45 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "range": Array [ + 7, + 30, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "name": "a", - "range": Array [ - 12, - 21, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 21, + "column": 29, "line": 1, }, "start": Object { @@ -111331,130 +113412,61 @@ Object { "line": 1, }, }, + "params": Array [], "range": Array [ 13, - 21, + 29, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 21, + "column": 29, "line": 1, }, "start": Object { - "column": 15, + "column": 20, "line": 1, }, }, "range": Array [ - 15, - 21, + 20, + 29, ], - "type": "TSNumberKeyword", - }, - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "b", - "optional": true, - "range": Array [ - 23, - 33, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 33, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, }, + "range": Array [ + 23, + 29, + ], + "type": "TSStringKeyword", }, - "range": Array [ - 27, - 33, - ], - "type": "TSNumberKeyword", }, + "type": "TSConstructorType", }, - }, - ], - "range": Array [ - 7, - 42, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, + ], "range": Array [ - 35, - 42, + 12, + 30, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 42, - ], - "type": "TSVoidKeyword", - }, + "type": "TSTypeParameterInstantiation", }, - "type": "TSConstructorType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 42, + "column": 30, "line": 1, }, "start": Object { @@ -111464,7 +113476,7 @@ Object { }, "range": Array [ 4, - 42, + 30, ], "type": "VariableDeclarator", }, @@ -111472,7 +113484,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 43, + "column": 31, "line": 1, }, "start": Object { @@ -111482,7 +113494,7 @@ Object { }, "range": Array [ 0, - 43, + 31, ], "type": "VariableDeclaration", }, @@ -111499,7 +113511,7 @@ Object { }, "range": Array [ 0, - 44, + 32, ], "sourceType": "script", "tokens": Array [ @@ -111537,7 +113549,7 @@ Object { 5, ], "type": "Identifier", - "value": "f", + "value": "x", }, Object { "loc": Object { @@ -111560,7 +113572,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { @@ -111570,28 +113582,10 @@ Object { }, "range": Array [ 7, - 10, - ], - "type": "Keyword", - "value": "new", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, 12, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { @@ -111608,13 +113602,13 @@ Object { 12, 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { @@ -111624,187 +113618,115 @@ Object { }, "range": Array [ 13, - 14, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 21, + 16, ], - "type": "Identifier", - "value": "number", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 18, "line": 1, }, "start": Object { - "column": 21, + "column": 17, "line": 1, }, }, "range": Array [ - 21, - 22, + 17, + 18, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - "value": "b", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 19, "line": 1, }, "start": Object { - "column": 24, + "column": 18, "line": 1, }, }, "range": Array [ - 24, - 25, + 18, + 19, ], "type": "Punctuator", - "value": "?", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 22, "line": 1, }, "start": Object { - "column": 25, + "column": 20, "line": 1, }, }, "range": Array [ - 25, - 26, + 20, + 22, ], "type": "Punctuator", - "value": ":", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 29, "line": 1, }, "start": Object { - "column": 27, + "column": 23, "line": 1, }, }, "range": Array [ - 27, - 33, + 23, + 29, ], "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 34, - ], - "type": "Punctuator", - "value": ")", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 30, "line": 1, }, "start": Object { - "column": 35, + "column": 29, "line": 1, }, }, "range": Array [ - 35, - 37, + 29, + 30, ], "type": "Punctuator", - "value": "=>", - }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 42, - ], - "type": "Keyword", - "value": "void", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 31, "line": 1, }, "start": Object { - "column": 42, + "column": 30, "line": 1, }, }, "range": Array [ - 42, - 43, + 30, + 31, ], "type": "Punctuator", "value": ";", @@ -111814,7 +113736,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-generic.src 1`] = ` +exports[`typescript fixtures/types/constructor-with-rest.src 1`] = ` Object { "body": Array [ Object { @@ -111823,7 +113745,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -111834,13 +113756,13 @@ Object { "name": "f", "range": Array [ 4, - 25, + 35, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -111850,13 +113772,13 @@ Object { }, "range": Array [ 5, - 25, + 35, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -111866,194 +113788,138 @@ Object { }, "params": Array [ Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 15, - 19, - ], - "type": "Identifier", - "typeAnnotation": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 19, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, + "name": "a", "range": Array [ + 15, 16, - 19, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - }, - }, - }, - ], - "range": Array [ - 7, - 25, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + "type": "Identifier", }, - }, - "range": Array [ - 21, - 25, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 25, + "column": 26, "line": 1, }, "start": Object { - "column": 24, + "column": 12, "line": 1, }, }, "range": Array [ - 24, - 25, + 12, + 26, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 24, - 25, - ], - "type": "Identifier", - }, - }, - }, - "type": "TSConstructorType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "params": Array [ - Object { + "type": "RestElement", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 13, + "column": 26, "line": 1, }, "start": Object { - "column": 12, + "column": 16, "line": 1, }, }, - "name": Object { + "range": Array [ + 16, + 26, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "TSNumberKeyword", + }, "loc": Object { "end": Object { - "column": 13, + "column": 26, "line": 1, }, "start": Object { - "column": 12, + "column": 18, "line": 1, }, }, - "name": "T", "range": Array [ - 12, - 13, + 18, + 26, ], - "type": "Identifier", + "type": "TSArrayType", }, - "range": Array [ - 12, - 13, - ], - "type": "TSTypeParameter", }, - ], + }, + ], + "range": Array [ + 7, + 35, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, "range": Array [ - 11, - 14, + 28, + 35, ], - "type": "TSTypeParameterDeclaration", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSConstructorType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { @@ -112063,7 +113929,7 @@ Object { }, "range": Array [ 4, - 25, + 35, ], "type": "VariableDeclarator", }, @@ -112071,7 +113937,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { @@ -112081,7 +113947,7 @@ Object { }, "range": Array [ 0, - 26, + 36, ], "type": "VariableDeclaration", }, @@ -112098,7 +113964,7 @@ Object { }, "range": Array [ 0, - 27, + 37, ], "sourceType": "script", "tokens": Array [ @@ -112190,12 +114056,12 @@ Object { 12, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { @@ -112205,115 +114071,115 @@ Object { }, "range": Array [ 12, - 13, + 15, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { - "column": 13, + "column": 15, "line": 1, }, }, "range": Array [ - 13, - 14, + 15, + 16, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { - "column": 14, + "column": 16, "line": 1, }, }, "range": Array [ - 14, - 15, + 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 1, }, "start": Object { - "column": 15, + "column": 18, "line": 1, }, }, "range": Array [ - 15, - 16, + 18, + 24, ], "type": "Identifier", - "value": "a", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 1, }, "start": Object { - "column": 16, + "column": 24, "line": 1, }, }, "range": Array [ - 16, - 17, + 24, + 25, ], "type": "Punctuator", - "value": ":", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 26, "line": 1, }, "start": Object { - "column": 18, + "column": 25, "line": 1, }, }, "range": Array [ - 18, - 19, + 25, + 26, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 27, "line": 1, }, "start": Object { - "column": 19, + "column": 26, "line": 1, }, }, "range": Array [ - 19, - 20, + 26, + 27, ], "type": "Punctuator", "value": ")", @@ -112321,17 +114187,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 30, "line": 1, }, "start": Object { - "column": 21, + "column": 28, "line": 1, }, }, "range": Array [ - 21, - 23, + 28, + 30, ], "type": "Punctuator", "value": "=>", @@ -112339,35 +114205,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { - "column": 24, + "column": 31, "line": 1, }, }, "range": Array [ - 24, - 25, + 31, + 35, ], - "type": "Identifier", - "value": "T", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { - "column": 25, + "column": 35, "line": 1, }, }, "range": Array [ - 25, - 26, + 35, + 36, ], "type": "Punctuator", "value": ";", @@ -112377,7 +114243,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-in-generic.src 1`] = ` +exports[`typescript fixtures/types/function.src 1`] = ` Object { "body": Array [ Object { @@ -112386,7 +114252,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -112394,16 +114260,16 @@ Object { "line": 1, }, }, - "name": "x", + "name": "f", "range": Array [ 4, - 30, + 38, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -112413,13 +114279,13 @@ Object { }, "range": Array [ 5, - 30, + 38, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -112427,107 +114293,159 @@ Object { "line": 1, }, }, - "range": Array [ - 7, - 30, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, - "start": Object { - "column": 7, - "line": 1, + "name": "a", + "range": Array [ + 8, + 17, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, }, }, - "name": "Array", - "range": Array [ - 7, - 12, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, }, - }, - "params": Array [ - Object { + "name": "b", + "optional": true, + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 29, "line": 1, }, "start": Object { - "column": 13, + "column": 21, "line": 1, }, }, - "params": Array [], "range": Array [ - 13, + 21, 29, ], - "returnType": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 29, "line": 1, }, "start": Object { - "column": 20, + "column": 23, "line": 1, }, }, "range": Array [ - 20, + 23, 29, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 29, - ], - "type": "TSStringKeyword", - }, + "type": "TSNumberKeyword", }, - "type": "TSConstructorType", }, - ], + }, + ], + "range": Array [ + 7, + 38, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, "range": Array [ - 12, - 30, + 31, + 38, ], - "type": "TSTypeParameterInstantiation", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 1, }, "start": Object { @@ -112537,7 +114455,7 @@ Object { }, "range": Array [ 4, - 30, + 38, ], "type": "VariableDeclarator", }, @@ -112545,7 +114463,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 1, }, "start": Object { @@ -112555,7 +114473,7 @@ Object { }, "range": Array [ 0, - 31, + 39, ], "type": "VariableDeclaration", }, @@ -112572,7 +114490,7 @@ Object { }, "range": Array [ 0, - 32, + 40, ], "sourceType": "script", "tokens": Array [ @@ -112610,7 +114528,7 @@ Object { 5, ], "type": "Identifier", - "value": "x", + "value": "f", }, Object { "loc": Object { @@ -112633,7 +114551,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 1, }, "start": Object { @@ -112643,46 +114561,64 @@ Object { }, "range": Array [ 7, - 12, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, ], "type": "Identifier", - "value": "Array", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 1, }, "start": Object { - "column": 12, + "column": 9, "line": 1, }, }, "range": Array [ - 12, - 13, + 9, + 10, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 1, }, "start": Object { - "column": 13, + "column": 11, "line": 1, }, }, "range": Array [ - 13, - 16, + 11, + 17, ], - "type": "Keyword", - "value": "new", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { @@ -112700,30 +114636,30 @@ Object { 18, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 1, }, "start": Object { - "column": 18, + "column": 19, "line": 1, }, }, "range": Array [ - 18, 19, + 20, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 21, "line": 1, }, "start": Object { @@ -112733,10 +114669,28 @@ Object { }, "range": Array [ 20, + 21, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, 22, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { @@ -112754,7 +114708,7 @@ Object { 29, ], "type": "Identifier", - "value": "string", + "value": "number", }, Object { "loc": Object { @@ -112771,23 +114725,59 @@ Object { 29, 30, ], - "type": "Punctuator", - "value": ">", + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 33, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 1, }, "start": Object { - "column": 30, + "column": 38, "line": 1, }, }, "range": Array [ - 30, - 31, + 38, + 39, ], "type": "Punctuator", "value": ";", @@ -112797,7 +114787,7 @@ Object { } `; -exports[`typescript fixtures/types/constructor-with-rest.src 1`] = ` +exports[`typescript fixtures/types/function-generic.src 1`] = ` Object { "body": Array [ Object { @@ -112806,7 +114796,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -112817,13 +114807,13 @@ Object { "name": "f", "range": Array [ 4, - 35, + 21, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -112833,13 +114823,13 @@ Object { }, "range": Array [ 5, - 35, + 21, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -112849,138 +114839,194 @@ Object { }, "params": Array [ Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, + "name": "a", "range": Array [ - 12, - 26, + 11, + 15, ], - "type": "RestElement", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 16, + "column": 12, "line": 1, }, }, "range": Array [ - 16, - 26, + 12, + 15, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { - "elementType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 24, + "column": 15, "line": 1, }, "start": Object { - "column": 18, + "column": 14, "line": 1, }, }, + "name": "T", "range": Array [ - 18, - 24, + 14, + 15, ], - "type": "TSNumberKeyword", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "type": "Identifier", }, - "range": Array [ - 18, - 26, - ], - "type": "TSArrayType", }, }, }, ], "range": Array [ 7, - 35, + 21, ], "returnType": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ - 28, - 35, + 17, + 21, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 31, + "column": 20, "line": 1, }, }, "range": Array [ - 31, - 35, + 20, + 21, ], - "type": "TSVoidKeyword", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, }, }, - "type": "TSConstructorType", + "type": "TSFunctionType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 9, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "TSTypeParameterDeclaration", + }, }, }, }, "init": null, "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { @@ -112990,7 +115036,7 @@ Object { }, "range": Array [ 4, - 35, + 21, ], "type": "VariableDeclarator", }, @@ -112998,7 +115044,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 36, + "column": 22, "line": 1, }, "start": Object { @@ -113008,7 +115054,7 @@ Object { }, "range": Array [ 0, - 36, + 22, ], "type": "VariableDeclaration", }, @@ -113025,7 +115071,7 @@ Object { }, "range": Array [ 0, - 37, + 23, ], "sourceType": "script", "tokens": Array [ @@ -113086,7 +115132,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 1, }, "start": Object { @@ -113096,151 +115142,133 @@ Object { }, "range": Array [ 7, - 10, - ], - "type": "Keyword", - "value": "new", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, + 8, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { - "column": 12, + "column": 8, "line": 1, }, }, "range": Array [ - 12, - 15, + 8, + 9, ], - "type": "Punctuator", - "value": "...", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { - "column": 15, + "column": 9, "line": 1, }, }, "range": Array [ - 15, - 16, + 9, + 10, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 17, + 10, + 11, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 12, "line": 1, }, "start": Object { - "column": 18, + "column": 11, "line": 1, }, }, "range": Array [ - 18, - 24, + 11, + 12, ], "type": "Identifier", - "value": "number", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 13, "line": 1, }, "start": Object { - "column": 24, + "column": 12, "line": 1, }, }, "range": Array [ - 24, - 25, + 12, + 13, ], "type": "Punctuator", - "value": "[", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 25, + "column": 14, "line": 1, }, }, "range": Array [ - 25, - 26, + 14, + 15, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 16, "line": 1, }, "start": Object { - "column": 26, + "column": 15, "line": 1, }, }, "range": Array [ - 26, - 27, + 15, + 16, ], "type": "Punctuator", "value": ")", @@ -113248,17 +115276,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 19, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ - 28, - 30, + 17, + 19, ], "type": "Punctuator", "value": "=>", @@ -113266,35 +115294,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 31, + "column": 20, "line": 1, }, }, "range": Array [ - 31, - 35, + 20, + 21, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 22, "line": 1, }, "start": Object { - "column": 35, + "column": 21, "line": 1, }, }, "range": Array [ - 35, - 36, + 21, + 22, ], "type": "Punctuator", "value": ";", @@ -113304,7 +115332,7 @@ Object { } `; -exports[`typescript fixtures/types/function.src 1`] = ` +exports[`typescript fixtures/types/function-in-generic.src 1`] = ` Object { "body": Array [ Object { @@ -113313,7 +115341,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -113321,16 +115349,16 @@ Object { "line": 1, }, }, - "name": "f", + "name": "x", "range": Array [ 4, - 38, + 24, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -113340,13 +115368,13 @@ Object { }, "range": Array [ 5, - 38, + 24, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -113354,159 +115382,107 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "range": Array [ + 7, + 24, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "name": "a", - "range": Array [ - 8, - 17, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 17, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 17, - ], - "type": "TSNumberKeyword", - }, + "start": Object { + "column": 7, + "line": 1, }, }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, + "name": "Array", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, }, - "name": "b", - "optional": true, - "range": Array [ - 19, - 29, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 21, + "column": 13, "line": 1, }, }, + "params": Array [], "range": Array [ - 21, - 29, + 13, + 23, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 23, + "column": 16, "line": 1, }, }, "range": Array [ + 16, 23, - 29, ], - "type": "TSNumberKeyword", - }, - }, - }, - ], - "range": Array [ - 7, - 38, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 38, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, - "range": Array [ - 34, - 38, - ], - "type": "TSVoidKeyword", - }, + ], + "range": Array [ + 12, + 24, + ], + "type": "TSTypeParameterInstantiation", }, - "type": "TSFunctionType", }, }, }, "init": null, "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { @@ -113516,7 +115492,7 @@ Object { }, "range": Array [ 4, - 38, + 24, ], "type": "VariableDeclarator", }, @@ -113524,7 +115500,7 @@ Object { "kind": "let", "loc": Object { "end": Object { - "column": 39, + "column": 25, "line": 1, }, "start": Object { @@ -113534,7 +115510,7 @@ Object { }, "range": Array [ 0, - 39, + 25, ], "type": "VariableDeclaration", }, @@ -113551,7 +115527,7 @@ Object { }, "range": Array [ 0, - 40, + 26, ], "sourceType": "script", "tokens": Array [ @@ -113589,7 +115565,7 @@ Object { 5, ], "type": "Identifier", - "value": "f", + "value": "x", }, Object { "loc": Object { @@ -113612,7 +115588,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { @@ -113622,64 +115598,64 @@ Object { }, "range": Array [ 7, - 8, + 12, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { - "column": 8, + "column": 12, "line": 1, }, }, "range": Array [ - 8, - 9, + 12, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 14, "line": 1, }, "start": Object { - "column": 9, + "column": 13, "line": 1, }, }, "range": Array [ - 9, - 10, + 13, + 14, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 14, "line": 1, }, }, "range": Array [ - 11, - 17, + 14, + 15, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -113688,21 +115664,21 @@ Object { "line": 1, }, "start": Object { - "column": 17, + "column": 16, "line": 1, }, }, "range": Array [ - 17, + 16, 18, ], "type": "Punctuator", - "value": ",", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 23, "line": 1, }, "start": Object { @@ -113712,51 +115688,15 @@ Object { }, "range": Array [ 19, - 20, - ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": "?", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, + 23, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 24, "line": 1, }, "start": Object { @@ -113766,358 +115706,195 @@ Object { }, "range": Array [ 23, - 29, - ], - "type": "Identifier", - "value": "number", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, + 24, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 25, "line": 1, }, "start": Object { - "column": 31, + "column": 24, "line": 1, }, }, "range": Array [ - 31, - 33, + 24, + 25, ], "type": "Punctuator", - "value": "=>", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/types/function-with-array-destruction.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", }, - "range": Array [ - 34, - 38, - ], - "type": "Keyword", - "value": "void", - }, - Object { "loc": Object { "end": Object { - "column": 39, + "column": 28, "line": 1, }, "start": Object { - "column": 38, + "column": 0, "line": 1, }, }, "range": Array [ - 38, - 39, + 0, + 28, ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/types/function-generic.src 1`] = ` -Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + ], "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, - "name": "f", "range": Array [ - 4, - 21, + 12, + 20, ], - "type": "Identifier", + "type": "ArrayPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 5, + "column": 15, "line": 1, }, }, "range": Array [ - 5, - 21, + 15, + 20, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 7, + "column": 17, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 11, - 15, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 15, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - }, - }, - }, - ], "range": Array [ - 7, - 21, + 17, + 20, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 21, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, - }, - }, - "type": "TSFunctionType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - "range": Array [ - 8, - 9, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 7, - 10, - ], - "type": "TSTypeParameterDeclaration", - }, + "type": "TSAnyKeyword", }, }, }, - "init": null, + ], + "range": Array [ + 11, + 28, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 21, + "column": 28, "line": 1, }, "start": Object { - "column": 4, + "column": 22, "line": 1, }, }, "range": Array [ - 4, - 21, + 22, + 28, ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 22, - ], - "type": "VariableDeclaration", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, + }, + "type": "TSFunctionType", + }, }, ], "loc": Object { @@ -114132,14 +115909,14 @@ Object { }, "range": Array [ 0, - 23, + 29, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { @@ -114149,33 +115926,15 @@ Object { }, "range": Array [ 0, - 3, - ], - "type": "Keyword", - "value": "let", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ 4, - 5, ], "type": "Identifier", - "value": "f", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -114185,46 +115944,10 @@ Object { }, "range": Array [ 5, - 6, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ 8, - 9, ], "type": "Identifier", - "value": "T", + "value": "foo", }, Object { "loc": Object { @@ -114242,22 +115965,22 @@ Object { 10, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 1, }, "start": Object { - "column": 10, + "column": 11, "line": 1, }, }, "range": Array [ - 10, 11, + 12, ], "type": "Punctuator", "value": "(", @@ -114265,38 +115988,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, "range": Array [ - 11, 12, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -114313,8 +116036,8 @@ Object { 14, 15, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { @@ -114332,12 +116055,12 @@ Object { 16, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 1, }, "start": Object { @@ -114347,10 +116070,10 @@ Object { }, "range": Array [ 17, - 19, + 20, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { @@ -114367,213 +116090,250 @@ Object { 20, 21, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 24, "line": 1, }, "start": Object { - "column": 21, + "column": 22, "line": 1, }, }, "range": Array [ - 21, 22, + 24, ], "type": "Punctuator", - "value": ";", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "any", }, ], "type": "Program", } `; -exports[`typescript fixtures/types/function-in-generic.src 1`] = ` +exports[`typescript fixtures/types/function-with-object-destruction.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 24, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, - "name": "x", - "range": Array [ - 4, - 24, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", }, - }, - "range": Array [ - 5, - 24, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "kind": "init", "loc": Object { "end": Object { - "column": 24, + "column": 14, "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, + "method": false, "range": Array [ - 7, - 24, + 13, + 14, ], - "type": "TSTypeReference", - "typeName": Object { + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, - "name": "Array", + "name": "a", "range": Array [ - 7, - 12, + 13, + 14, ], "type": "Identifier", }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 13, - 23, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 23, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 23, - ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSFunctionType", - }, - ], - "range": Array [ - 12, - 24, - ], - "type": "TSTypeParameterInstantiation", }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", }, }, }, - "init": null, + ], + "range": Array [ + 11, + 28, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 24, + "column": 28, "line": 1, }, "start": Object { - "column": 4, + "column": 22, "line": 1, }, }, "range": Array [ - 4, - 24, + 22, + 28, ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, }, + "type": "TSFunctionType", }, - "range": Array [ - 0, - 25, - ], - "type": "VariableDeclaration", }, ], "loc": Object { @@ -114588,14 +116348,14 @@ Object { }, "range": Array [ 0, - 26, + 29, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { @@ -114605,46 +116365,46 @@ Object { }, "range": Array [ 0, - 3, + 4, ], - "type": "Keyword", - "value": "let", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 5, "line": 1, }, }, "range": Array [ - 4, 5, + 8, ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 6, + 9, + 10, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { @@ -114653,16 +116413,16 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 11, "line": 1, }, }, "range": Array [ - 7, + 11, 12, ], - "type": "Identifier", - "value": "Array", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -114680,7 +116440,7 @@ Object { 13, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { @@ -114697,8 +116457,8 @@ Object { 13, 14, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -114716,43 +116476,61 @@ Object { 15, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, "range": Array [ + 15, 16, - 18, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 20, "line": 1, }, "start": Object { - "column": 19, + "column": 17, "line": 1, }, }, "range": Array [ - 19, - 23, + 17, + 20, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -114761,34 +116539,34 @@ Object { "line": 1, }, "start": Object { - "column": 23, + "column": 22, "line": 1, }, }, "range": Array [ - 23, + 22, 24, ], "type": "Punctuator", - "value": ">", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 28, "line": 1, }, "start": Object { - "column": 24, + "column": 25, "line": 1, }, }, "range": Array [ - 24, 25, + 28, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "any", }, ], "type": "Program",