diff --git a/CHANGELOG.md b/CHANGELOG.md index 490f45a7b3e1..7df61feebd24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + + +### Bug Fixes + +* **parser:** adds TTY check before logging the version mismatch warning ([#1121](https://github.com/typescript-eslint/typescript-eslint/issues/1121)) ([768ef63](https://github.com/typescript-eslint/typescript-eslint/commit/768ef63)) +* **typescript-estree:** better handle canonical paths ([#1111](https://github.com/typescript-eslint/typescript-eslint/issues/1111)) ([8dcbf4c](https://github.com/typescript-eslint/typescript-eslint/commit/8dcbf4c)) +* **typescript-estree:** correct parenthesized optional chain AST ([#1141](https://github.com/typescript-eslint/typescript-eslint/issues/1141)) ([5ae286e](https://github.com/typescript-eslint/typescript-eslint/commit/5ae286e)) +* **typescript-estree:** ensure parent pointers are set ([#1129](https://github.com/typescript-eslint/typescript-eslint/issues/1129)) ([d4703e1](https://github.com/typescript-eslint/typescript-eslint/commit/d4703e1)) +* **typescript-estree:** normalize paths to fix cache miss on windows ([#1128](https://github.com/typescript-eslint/typescript-eslint/issues/1128)) ([6d0f2ce](https://github.com/typescript-eslint/typescript-eslint/commit/6d0f2ce)) + + +### Features + +* **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) diff --git a/lerna.json b/lerna.json index 2a40ae9e906b..f3a88ed9b376 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.5.0", + "version": "2.6.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 5128c179c540..b3a92499169a 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 7e2168b5ff1c..00f7281ffef5 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "2.5.0", + "version": "2.6.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -31,7 +31,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.5.0", + "@typescript-eslint/experimental-utils": "2.6.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.5.0" + "@typescript-eslint/parser": "2.6.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index f40f2624eec6..09dfcf804632 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + + +### Features + +* **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md index 996d1d9aae13..48b98849c41e 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md @@ -59,6 +59,6 @@ The main downside to using this rule is the need for type information. ## Related To -- ESLint: [no-constant-condition](https://eslint.org/docs/rules/no-constant-condition) - this rule is essentially a stronger version. +- ESLint: [no-constant-condition](https://eslint.org/docs/rules/no-constant-condition) - `no-unnecessary-condition` is essentially a stronger version of `no-constant-condition`, but requires type information. -- [strict-boolean-expression](./strict-boolean-expressions.md) - a stricter alternative to this rule. +- [strict-boolean-expressions](./strict-boolean-expressions.md) - a more opinionated version of `no-unnecessary-condition`. `strict-boolean-expressions` enforces a specific code style, while `no-unnecessary-condition` is about correctness. diff --git a/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md b/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md index 72d38f1ed66c..fd23d75cb5ef 100644 --- a/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md +++ b/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md @@ -63,4 +63,4 @@ Options may be provided as an object with: - TSLint: [strict-boolean-expressions](https://palantir.github.io/tslint/rules/strict-boolean-expressions) -- [no-unnecessary-condition](./no-unnecessary-condition.md) - a looser alternative to this rule. +- [no-unnecessary-condition](./no-unnecessary-condition.md) - essentially a less opinionated alternative to this rule. `strict-boolean-expressions` enforces a specific code style, while `no-unnecessary-condition` is about correctness. diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index cacc21e47137..e5ba66ba0408 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.5.0", + "version": "2.6.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.5.0", + "@typescript-eslint/experimental-utils": "2.6.0", "eslint-utils": "^1.4.2", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index 9951db4ea8b0..704bc09dc65b 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -163,6 +163,7 @@ export default util.createRule({ type, static: false, readonly: false, + declare: false, ...base, } as TSESTree.ClassProperty; } diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index dd63f064e21c..5d1e618d4424 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) **Note:** Version bump only for package @typescript-eslint/experimental-utils diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 0f26e278fec3..7cc729040e54 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.5.0", + "version": "2.6.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -37,7 +37,7 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.5.0", + "@typescript-eslint/typescript-estree": "2.6.0", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 1e2d3c4d0f6d..6075ce3ac7d5 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + + +### Bug Fixes + +* **typescript-estree:** correct parenthesized optional chain AST ([#1141](https://github.com/typescript-eslint/typescript-eslint/issues/1141)) ([5ae286e](https://github.com/typescript-eslint/typescript-eslint/commit/5ae286e)) + + +### Features + +* **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 7e3f5e3ce340..d6ea0d95f60a 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.5.0", + "version": "2.6.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -43,13 +43,13 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.5.0", - "@typescript-eslint/typescript-estree": "2.5.0", + "@typescript-eslint/experimental-utils": "2.6.0", + "@typescript-eslint/typescript-estree": "2.6.0", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.5.0", + "@typescript-eslint/shared-fixtures": "2.6.0", "glob": "^7.1.4" } } diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index ab627ecea750..3d94d81e424b 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -932,6 +932,171 @@ Object { } `; +exports[`typescript fixtures/basics/abstract-class-with-declare-properties.src 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 230, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 230, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 229, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "AbstractDeclProps": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "AbstractDeclProps", + "range": Array [ + 15, + 32, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 229, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "AbstractDeclProps", + "range": Array [ + 15, + 32, + ], + "type": "Identifier", + }, + ], + "name": "AbstractDeclProps", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "AbstractDeclProps": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "AbstractDeclProps", + "range": Array [ + 15, + 32, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 229, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "AbstractDeclProps", + "range": Array [ + 15, + 32, + ], + "type": "Identifier", + }, + ], + "name": "AbstractDeclProps", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], +} +`; + exports[`typescript fixtures/basics/abstract-class-with-optional-method.src 1`] = ` Object { "$id": 4, @@ -4605,13 +4770,13 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-definite-assignment.src 1`] = ` +exports[`typescript fixtures/basics/class-with-declare-properties.src 1`] = ` Object { "$id": 4, "block": Object { "range": Array [ 0, - 26, + 271, ], "type": "Program", }, @@ -4621,7 +4786,7 @@ Object { "block": Object { "range": Array [ 0, - 26, + 271, ], "type": "Program", }, @@ -4631,7 +4796,7 @@ Object { "block": Object { "range": Array [ 0, - 25, + 270, ], "type": "ClassDeclaration", }, @@ -4645,7 +4810,7 @@ Object { "$ref": 3, }, "variableMap": Object { - "X": Object { + "DeclProps": Object { "$ref": 1, }, }, @@ -4658,17 +4823,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "X", + "name": "DeclProps", "range": Array [ 6, - 7, + 15, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 25, + 270, ], "type": "ClassDeclaration", }, @@ -4679,15 +4844,15 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "X", + "name": "DeclProps", "range": Array [ 6, - 7, + 15, ], "type": "Identifier", }, ], - "name": "X", + "name": "DeclProps", "references": Array [], "scope": Object { "$ref": 2, @@ -4705,7 +4870,7 @@ Object { "$ref": 4, }, "variableMap": Object { - "X": Object { + "DeclProps": Object { "$ref": 0, }, }, @@ -4718,17 +4883,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "X", + "name": "DeclProps", "range": Array [ 6, - 7, + 15, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 25, + 270, ], "type": "ClassDeclaration", }, @@ -4739,15 +4904,15 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "X", + "name": "DeclProps", "range": Array [ 6, - 7, + 15, ], "type": "Identifier", }, ], - "name": "X", + "name": "DeclProps", "references": Array [], "scope": Object { "$ref": 3, @@ -4770,79 +4935,244 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-export-parameter-properties.src 1`] = ` +exports[`typescript fixtures/basics/class-with-definite-assignment.src 1`] = ` Object { - "$id": 7, + "$id": 4, "block": Object { "range": Array [ 0, - 58, + 26, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 6, + "$id": 3, "block": Object { "range": Array [ 0, - 58, + 26, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 5, + "$id": 2, "block": Object { "range": Array [ 0, - 56, + 25, ], "type": "ClassDeclaration", }, - "childScopes": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "X": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ Object { - "$id": 4, - "block": Object { - "range": Array [ - 27, - 54, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object { - "a": Object { - "$ref": 3, - }, - "arguments": Object { - "$ref": 2, - }, - }, - "variableScope": Object { - "$ref": 4, - }, - "variables": Array [ + "$id": 1, + "defs": Array [ Object { - "$id": 2, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 4, + "name": Object { + "name": "X", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", }, - }, - Object { + "node": Object { + "range": Array [ + 0, + 25, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "X", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "X", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "X": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "X", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 25, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "X", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "X", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/class-with-export-parameter-properties.src 1`] = ` +Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 58, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 58, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 56, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 27, + 54, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "a": Object { + "$ref": 3, + }, + "arguments": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { "$id": 3, "defs": Array [ Object { @@ -22242,31 +22572,31 @@ Object { exports[`typescript fixtures/basics/optional-chain-call.src 1`] = ` Object { - "$id": 22, + "$id": 23, "block": Object { "range": Array [ 0, - 181, + 194, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 21, + "$id": 22, "block": Object { "range": Array [ 0, - 181, + 194, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 20, + "$id": 21, "block": Object { "range": Array [ 0, - 180, + 193, ], "type": "FunctionDeclaration", }, @@ -22277,7 +22607,7 @@ Object { Object { "$id": 3, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22296,7 +22626,7 @@ Object { Object { "$id": 4, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "fn", @@ -22313,7 +22643,7 @@ Object { Object { "$id": 5, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22332,7 +22662,7 @@ Object { Object { "$id": 6, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "two", @@ -22349,7 +22679,7 @@ Object { Object { "$id": 7, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "fn", @@ -22366,7 +22696,7 @@ Object { Object { "$id": 8, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22385,7 +22715,7 @@ Object { Object { "$id": 9, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "fn", @@ -22402,7 +22732,7 @@ Object { Object { "$id": 10, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22421,7 +22751,7 @@ Object { Object { "$id": 11, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "three", @@ -22438,7 +22768,7 @@ Object { Object { "$id": 12, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "fn", @@ -22455,7 +22785,7 @@ Object { Object { "$id": 13, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22474,7 +22804,7 @@ Object { Object { "$id": 14, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "three", @@ -22491,7 +22821,7 @@ Object { Object { "$id": 15, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "fn", @@ -22508,7 +22838,7 @@ Object { Object { "$id": 16, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22527,7 +22857,7 @@ Object { Object { "$id": 17, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22546,13 +22876,13 @@ Object { Object { "$id": 18, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", "range": Array [ + 163, 166, - 169, ], "type": "Identifier", }, @@ -22565,13 +22895,32 @@ Object { Object { "$id": 19, "from": Object { - "$ref": 20, + "$ref": 21, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 179, + 182, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 20, + "from": Object { + "$ref": 21, }, "identifier": Object { "name": "two", "range": Array [ - 174, - 177, + 187, + 190, ], "type": "Identifier", }, @@ -22606,12 +22955,12 @@ Object { "$ref": 15, }, Object { - "$ref": 19, + "$ref": 20, }, ], "type": "function", "upperScope": Object { - "$ref": 21, + "$ref": 22, }, "variableMap": Object { "arguments": Object { @@ -22622,7 +22971,7 @@ Object { }, }, "variableScope": Object { - "$ref": 20, + "$ref": 21, }, "variables": Array [ Object { @@ -22633,7 +22982,7 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 20, + "$ref": 21, }, }, Object { @@ -22651,7 +23000,7 @@ Object { "node": Object { "range": Array [ 0, - 180, + 193, ], "type": "FunctionDeclaration", }, @@ -22696,9 +23045,12 @@ Object { Object { "$ref": 18, }, + Object { + "$ref": 19, + }, ], "scope": Object { - "$ref": 20, + "$ref": 21, }, }, ], @@ -22733,12 +23085,12 @@ Object { "$ref": 15, }, Object { - "$ref": 19, + "$ref": 20, }, ], "type": "module", "upperScope": Object { - "$ref": 22, + "$ref": 23, }, "variableMap": Object { "processOptionalCall": Object { @@ -22746,7 +23098,7 @@ Object { }, }, "variableScope": Object { - "$ref": 21, + "$ref": 22, }, "variables": Array [ Object { @@ -22764,7 +23116,7 @@ Object { "node": Object { "range": Array [ 0, - 180, + 193, ], "type": "FunctionDeclaration", }, @@ -22786,7 +23138,7 @@ Object { "name": "processOptionalCall", "references": Array [], "scope": Object { - "$ref": 21, + "$ref": 22, }, }, ], @@ -22821,46 +23173,46 @@ Object { "$ref": 15, }, Object { - "$ref": 19, + "$ref": 20, }, ], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 22, + "$ref": 23, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-call-with-parens.src 1`] = ` Object { - "$id": 11, + "$id": 20, "block": Object { "range": Array [ 0, - 142, + 218, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 10, + "$id": 19, "block": Object { "range": Array [ 0, - 142, + 218, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 9, + "$id": 18, "block": Object { "range": Array [ 0, - 141, + 217, ], "type": "FunctionDeclaration", }, @@ -22871,13 +23223,13 @@ Object { Object { "$id": 3, "from": Object { - "$ref": 9, + "$ref": 18, }, "identifier": Object { "name": "one", "range": Array [ - 47, - 50, + 51, + 54, ], "type": "Identifier", }, @@ -22890,32 +23242,1230 @@ Object { Object { "$id": 4, "from": Object { - "$ref": 9, + "$ref": 18, }, "identifier": Object { - "name": "one", + "name": "fn", "range": Array [ - 59, - 62, + 56, + 58, ], "type": "Identifier", }, "kind": "r", - "resolved": Object { - "$ref": 2, - }, + "resolved": null, "writeExpr": undefined, }, Object { "$id": 5, "from": Object { - "$ref": 9, + "$ref": 18, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 66, + 69, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "two", + "range": Array [ + 71, + 74, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "fn", + "range": Array [ + 94, + 96, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 113, + 118, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 129, + 132, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 138, + 143, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 13, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "fn", + "range": Array [ + 145, + 147, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 14, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 156, + 159, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 15, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 169, + 172, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 16, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 184, + 187, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 17, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 202, + 205, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 13, + }, + ], + "type": "function", + "upperScope": Object { + "$ref": 19, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "one": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 18, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "one", + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 217, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "one", + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + }, + ], + "name": "one", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + Object { + "$ref": 11, + }, + Object { + "$ref": 14, + }, + Object { + "$ref": 15, + }, + Object { + "$ref": 16, + }, + Object { + "$ref": 17, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 13, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 20, + }, + "variableMap": Object { + "processOptionalCallParens": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 19, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "processOptionalCallParens", + "range": Array [ + 9, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 217, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "processOptionalCallParens", + "range": Array [ + 9, + 34, + ], + "type": "Identifier", + }, + ], + "name": "processOptionalCallParens", + "references": Array [], + "scope": Object { + "$ref": 19, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 13, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 20, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` +Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 142, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 142, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 141, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "one": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 9, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "one", + "range": Array [ + 32, + 41, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 141, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "one", + "range": Array [ + 32, + 41, + ], + "type": "Identifier", + }, + ], + "name": "one", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 8, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "processOptionalElement": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "processOptionalElement", + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 141, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "processOptionalElement", + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + }, + ], + "name": "processOptionalElement", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/optional-chain-element-access-with-parens.src 1`] = ` +Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 168, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 168, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 167, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 68, + 71, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 102, + 105, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 144, + 147, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "one": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 9, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "one", + "range": Array [ + 38, + 47, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 167, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "one", + "range": Array [ + 38, + 47, + ], + "type": "Identifier", + }, + ], + "name": "one", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 8, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "processOptionalElementParens": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "processOptionalElementParens", + "range": Array [ + 9, + 37, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 167, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "processOptionalElementParens", + "range": Array [ + 9, + 37, + ], + "type": "Identifier", + }, + ], + "name": "processOptionalElementParens", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/optional-chain-with-parens.src 1`] = ` +Object { + "$id": 19, + "block": Object { + "range": Array [ + 0, + 182, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 18, + "block": Object { + "range": Array [ + 0, + 182, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 17, + "block": Object { + "range": Array [ + 0, + 181, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "two", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "two", + "range": Array [ + 66, + 69, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 17, }, "identifier": Object { "name": "one", "range": Array [ - 74, - 77, + 81, + 84, ], "type": "Identifier", }, @@ -22926,15 +24476,32 @@ Object { "writeExpr": undefined, }, Object { - "$id": 6, + "$id": 8, "from": Object { - "$ref": 9, + "$ref": 17, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 90, + 95, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 17, }, "identifier": Object { "name": "one", "range": Array [ - 89, - 92, + 101, + 104, ], "type": "Identifier", }, @@ -22945,15 +24512,32 @@ Object { "writeExpr": undefined, }, Object { - "$id": 7, + "$id": 10, "from": Object { - "$ref": 9, + "$ref": 17, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 110, + 115, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 17, }, "identifier": Object { "name": "one", "range": Array [ - 104, - 107, + 126, + 129, ], "type": "Identifier", }, @@ -22964,15 +24548,49 @@ Object { "writeExpr": undefined, }, Object { - "$id": 8, + "$id": 12, "from": Object { - "$ref": 9, + "$ref": 17, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 135, + 140, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 13, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "four", + "range": Array [ + 142, + 146, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 14, + "from": Object { + "$ref": 17, }, "identifier": Object { "name": "one", "range": Array [ - 122, - 125, + 152, + 155, ], "type": "Identifier", }, @@ -22982,11 +24600,70 @@ Object { }, "writeExpr": undefined, }, + Object { + "$id": 15, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 161, + 166, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 16, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "four", + "range": Array [ + 168, + 172, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 13, + }, + Object { + "$ref": 15, + }, + Object { + "$ref": 16, + }, ], - "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 10, + "$ref": 18, }, "variableMap": Object { "arguments": Object { @@ -22997,7 +24674,7 @@ Object { }, }, "variableScope": Object { - "$ref": 9, + "$ref": 17, }, "variables": Array [ Object { @@ -23008,7 +24685,7 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 9, + "$ref": 17, }, }, Object { @@ -23018,15 +24695,15 @@ Object { "name": Object { "name": "one", "range": Array [ - 32, - 41, + 31, + 40, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 141, + 181, ], "type": "FunctionDeclaration", }, @@ -23039,8 +24716,8 @@ Object { Object { "name": "one", "range": Array [ - 32, - 41, + 31, + 40, ], "type": "Identifier", }, @@ -23051,23 +24728,23 @@ Object { "$ref": 3, }, Object { - "$ref": 4, + "$ref": 5, }, Object { - "$ref": 5, + "$ref": 7, }, Object { - "$ref": 6, + "$ref": 9, }, Object { - "$ref": 7, + "$ref": 11, }, Object { - "$ref": 8, + "$ref": 14, }, ], "scope": Object { - "$ref": 9, + "$ref": 17, }, }, ], @@ -23076,18 +24753,43 @@ Object { "functionExpressionScope": false, "isStrict": true, "references": Array [], - "throughReferences": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 13, + }, + Object { + "$ref": 15, + }, + Object { + "$ref": 16, + }, + ], "type": "module", "upperScope": Object { - "$ref": 11, + "$ref": 19, }, "variableMap": Object { - "processOptionalElement": Object { + "processOptionalParens": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 10, + "$ref": 18, }, "variables": Array [ Object { @@ -23095,17 +24797,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "processOptionalElement", + "name": "processOptionalParens", "range": Array [ 9, - 31, + 30, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 141, + 181, ], "type": "FunctionDeclaration", }, @@ -23116,18 +24818,18 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "processOptionalElement", + "name": "processOptionalParens", "range": Array [ 9, - 31, + 30, ], "type": "Identifier", }, ], - "name": "processOptionalElement", + "name": "processOptionalParens", "references": Array [], "scope": Object { - "$ref": 10, + "$ref": 18, }, }, ], @@ -23136,12 +24838,37 @@ Object { "functionExpressionScope": false, "isStrict": false, "references": Array [], - "throughReferences": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 13, + }, + Object { + "$ref": 15, + }, + Object { + "$ref": 16, + }, + ], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 11, + "$ref": 19, }, "variables": Array [], } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 3fef3f0ee9a4..87ceff1bc553 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + + +### Bug Fixes + +* **typescript-estree:** correct parenthesized optional chain AST ([#1141](https://github.com/typescript-eslint/typescript-eslint/issues/1141)) ([5ae286e](https://github.com/typescript-eslint/typescript-eslint/commit/5ae286e)) + + +### Features + +* **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) **Note:** Version bump only for package @typescript-eslint/shared-fixtures diff --git a/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-declare-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-declare-properties.src.ts new file mode 100644 index 000000000000..307d36a66163 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-declare-properties.src.ts @@ -0,0 +1,7 @@ +abstract class AbstractDeclProps { + declare prop1: string; + declare abstract prop2: string; + declare public abstract prop3: string; + declare readonly abstract prop4: string; + declare public readonly abstract prop5: string; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/class-with-declare-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-declare-properties.src.ts new file mode 100644 index 000000000000..3b37e42e4b19 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/class-with-declare-properties.src.ts @@ -0,0 +1,9 @@ +class DeclProps { + declare prop1: string; + declare public prop2: string; + declare static prop3: string; + declare readonly prop3: string; + declare public readonly prop4: string; + declare public static prop5: string; + declare public static readonly prop6: string; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call-with-parens.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call-with-parens.src.ts new file mode 100644 index 000000000000..4024fffa9d58 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call-with-parens.src.ts @@ -0,0 +1,13 @@ +function processOptionalCallParens(one?: any) { + (one?.fn()); + (one?.two).fn(); + (one.two?.fn()); + (one.two?.three).fn(); + (one.two?.three?.fn()); + + (one?.()); + (one?.())(); + (one?.())?.(); + + (one?.()).two; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call.src.ts index 7de9343489eb..c411490d129b 100644 --- a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call.src.ts +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call.src.ts @@ -6,6 +6,7 @@ function processOptionalCall(one?: any) { one.two?.three?.fn(); one?.(); + one?.()(); one?.()?.(); one?.().two; diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access-with-parens.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access-with-parens.src.ts new file mode 100644 index 000000000000..a4a30b2d5df6 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access-with-parens.src.ts @@ -0,0 +1,8 @@ +function processOptionalElementParens(one?: any) { + (one?.[2]); + (one?.[2])[3]; + (one[2]?.[3]); + (one[2]?.[3])[4]; + (one[2]?.[3]?.[4]); + (one[2]?.[3]?.[4])[5]; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-with-parens.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-with-parens.src.ts new file mode 100644 index 000000000000..69c9e8efee51 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-with-parens.src.ts @@ -0,0 +1,8 @@ +function processOptionalParens(one?: any) { + (one?.two); + (one?.two).three; + (one.two?.three); + (one.two?.three).four; + (one.two?.three?.four); + (one.two?.three?.four).five; +} diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index b482cfdcf92b..a19e0cd1e5a7 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.5.0", + "version": "2.6.0", "private": true, "scripts": { "build": "tsc -b tsconfig.build.json", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 2389fef6c569..e1232b70926b 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + + +### Bug Fixes + +* **parser:** adds TTY check before logging the version mismatch warning ([#1121](https://github.com/typescript-eslint/typescript-eslint/issues/1121)) ([768ef63](https://github.com/typescript-eslint/typescript-eslint/commit/768ef63)) +* **typescript-estree:** better handle canonical paths ([#1111](https://github.com/typescript-eslint/typescript-eslint/issues/1111)) ([8dcbf4c](https://github.com/typescript-eslint/typescript-eslint/commit/8dcbf4c)) +* **typescript-estree:** correct parenthesized optional chain AST ([#1141](https://github.com/typescript-eslint/typescript-eslint/issues/1141)) ([5ae286e](https://github.com/typescript-eslint/typescript-eslint/commit/5ae286e)) +* **typescript-estree:** ensure parent pointers are set ([#1129](https://github.com/typescript-eslint/typescript-eslint/issues/1129)) ([d4703e1](https://github.com/typescript-eslint/typescript-eslint/commit/d4703e1)) +* **typescript-estree:** normalize paths to fix cache miss on windows ([#1128](https://github.com/typescript-eslint/typescript-eslint/issues/1128)) ([6d0f2ce](https://github.com/typescript-eslint/typescript-eslint/commit/6d0f2ce)) + + +### Features + +* **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 508d8400531d..e28166f1eb88 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.5.0", + "version": "2.6.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -57,7 +57,7 @@ "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", "@types/tmp": "^0.1.0", - "@typescript-eslint/shared-fixtures": "2.5.0", + "@typescript-eslint/shared-fixtures": "2.6.0", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 598178158b01..67ca0be79b89 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -926,6 +926,7 @@ export class Converter { computed: isComputedProperty(node.name), static: hasModifier(SyntaxKind.StaticKeyword, node), readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, + declare: hasModifier(SyntaxKind.DeclareKeyword, node), }); if (node.type) { @@ -1690,16 +1691,19 @@ export class Converter { } case SyntaxKind.PropertyAccessExpression: { - const isLocallyOptional = node.questionDotToken !== undefined; const object = this.convertChild(node.expression); const property = this.convertChild(node.name); const computed = false; - if ( - isLocallyOptional || - // the optional expression should propogate up the member expression tree - object.type === AST_NODE_TYPES.OptionalMemberExpression || - object.type === AST_NODE_TYPES.OptionalCallExpression - ) { + + const isLocallyOptional = node.questionDotToken !== undefined; + // the optional expression should propogate up the member expression tree + const isChildOptional = + (object.type === AST_NODE_TYPES.OptionalMemberExpression || + object.type === AST_NODE_TYPES.OptionalCallExpression) && + // (x?.y).z is semantically different, and as such .z is no longer optional + node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression; + + if (isLocallyOptional || isChildOptional) { return this.createNode(node, { type: AST_NODE_TYPES.OptionalMemberExpression, object, @@ -1719,16 +1723,19 @@ export class Converter { } case SyntaxKind.ElementAccessExpression: { - const isLocallyOptional = node.questionDotToken !== undefined; const object = this.convertChild(node.expression); const property = this.convertChild(node.argumentExpression); const computed = true; - if ( - isLocallyOptional || - // the optional expression should propogate up the member expression tree - object.type === AST_NODE_TYPES.OptionalMemberExpression || - object.type === AST_NODE_TYPES.OptionalCallExpression - ) { + + const isLocallyOptional = node.questionDotToken !== undefined; + // the optional expression should propogate up the member expression tree + const isChildOptional = + (object.type === AST_NODE_TYPES.OptionalMemberExpression || + object.type === AST_NODE_TYPES.OptionalCallExpression) && + // (x?.y).z is semantically different, and as such .z is no longer optional + node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression; + + if (isLocallyOptional || isChildOptional) { return this.createNode(node, { type: AST_NODE_TYPES.OptionalMemberExpression, object, @@ -1748,16 +1755,19 @@ export class Converter { } case SyntaxKind.CallExpression: { - const isLocallyOptional = node.questionDotToken !== undefined; const callee = this.convertChild(node.expression); const args = node.arguments.map(el => this.convertChild(el)); let result; - if ( - isLocallyOptional || - // the optional expression should propogate up the member expression tree - callee.type === AST_NODE_TYPES.OptionalMemberExpression || - callee.type === AST_NODE_TYPES.OptionalCallExpression - ) { + + const isLocallyOptional = node.questionDotToken !== undefined; + // the optional expression should propogate up the member expression tree + const isChildOptional = + (callee.type === AST_NODE_TYPES.OptionalMemberExpression || + callee.type === AST_NODE_TYPES.OptionalCallExpression) && + // (x?.y).z() is semantically different, and as such .z() is no longer optional + node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression; + + if (isLocallyOptional || isChildOptional) { result = this.createNode(node, { type: AST_NODE_TYPES.OptionalCallExpression, callee, diff --git a/packages/typescript-estree/src/WatchCompilerHostOfConfigFile.ts b/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts similarity index 100% rename from packages/typescript-estree/src/WatchCompilerHostOfConfigFile.ts rename to packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index a0a8eeefb485..ddd2d90ccb19 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -3,8 +3,14 @@ import fs from 'fs'; import path from 'path'; import ts from 'typescript'; import { Extra } from '../parser-options'; -import { WatchCompilerHostOfConfigFile } from '../WatchCompilerHostOfConfigFile'; -import { getTsconfigPath, DEFAULT_COMPILER_OPTIONS } from './shared'; +import { WatchCompilerHostOfConfigFile } from './WatchCompilerHostOfConfigFile'; +import { + canonicalDirname, + CanonicalPath, + getTsconfigPath, + DEFAULT_COMPILER_OPTIONS, + getCanonicalFileName, +} from './shared'; const log = debug('typescript-eslint:typescript-estree:createWatchProgram'); @@ -12,7 +18,7 @@ const log = debug('typescript-eslint:typescript-estree:createWatchProgram'); * Maps tsconfig paths to their corresponding file contents and resulting watches */ const knownWatchProgramMap = new Map< - string, + CanonicalPath, ts.WatchOfConfigFile >(); @@ -21,25 +27,25 @@ const knownWatchProgramMap = new Map< * There may be more than one per file/folder if a file/folder is shared between projects */ const fileWatchCallbackTrackingMap = new Map< - string, + CanonicalPath, Set >(); const folderWatchCallbackTrackingMap = new Map< - string, + CanonicalPath, Set >(); /** * Stores the list of known files for each program */ -const programFileListCache = new Map>(); +const programFileListCache = new Map>(); /** * Caches the last modified time of the tsconfig files */ -const tsconfigLsatModifiedTimestampCache = new Map(); +const tsconfigLastModifiedTimestampCache = new Map(); -const parsedFilesSeen = new Set(); +const parsedFilesSeen = new Set(); /** * Clear all of the parser caches. @@ -51,7 +57,7 @@ function clearCaches(): void { folderWatchCallbackTrackingMap.clear(); parsedFilesSeen.clear(); programFileListCache.clear(); - tsconfigLsatModifiedTimestampCache.clear(); + tsconfigLastModifiedTimestampCache.clear(); } function saveWatchCallback( @@ -61,7 +67,7 @@ function saveWatchCallback( fileName: string, callback: ts.FileWatcherCallback, ): ts.FileWatcher => { - const normalizedFileName = path.normalize(fileName); + const normalizedFileName = getCanonicalFileName(path.normalize(fileName)); const watchers = ((): Set => { let watchers = trackingMap.get(normalizedFileName); if (!watchers) { @@ -83,9 +89,9 @@ function saveWatchCallback( /** * Holds information about the file currently being linted */ -const currentLintOperationState = { +const currentLintOperationState: { code: string; filePath: CanonicalPath } = { code: '', - filePath: '', + filePath: '' as CanonicalPath, }; /** @@ -101,16 +107,17 @@ function diagnosticReporter(diagnostic: ts.Diagnostic): void { /** * Calculate project environments using options provided by consumer and paths from config * @param code The code being linted - * @param filePath The path of the file being parsed + * @param filePathIn The path of the file being parsed * @param extra.tsconfigRootDir The root directory for relative tsconfig paths * @param extra.projects Provided tsconfig paths * @returns The programs corresponding to the supplied tsconfig paths */ function getProgramsForProjects( code: string, - filePath: string, + filePathIn: string, extra: Extra, ): ts.Program[] { + const filePath = getCanonicalFileName(filePathIn); const results = []; // preserve reference to code and file being linted @@ -145,13 +152,21 @@ function getProgramsForProjects( let updatedProgram: ts.Program | null = null; if (!fileList) { updatedProgram = existingWatch.getProgram().getProgram(); - fileList = new Set(updatedProgram.getRootFileNames()); + fileList = new Set( + updatedProgram.getRootFileNames().map(f => getCanonicalFileName(f)), + ); programFileListCache.set(tsconfigPath, fileList); } if (fileList.has(filePath)) { log('Found existing program for file. %s', filePath); - return [updatedProgram || existingWatch.getProgram().getProgram()]; + + updatedProgram = + updatedProgram || existingWatch.getProgram().getProgram(); + // sets parent pointers in source files + updatedProgram.getTypeChecker(); + + return [updatedProgram]; } } log( @@ -215,7 +230,8 @@ function createWatchProgram( // ensure readFile reads the code being linted instead of the copy on disk const oldReadFile = watchCompilerHost.readFile; - watchCompilerHost.readFile = (filePath, encoding): string | undefined => { + watchCompilerHost.readFile = (filePathIn, encoding): string | undefined => { + const filePath = getCanonicalFileName(filePathIn); parsedFilesSeen.add(filePath); return path.normalize(filePath) === path.normalize(currentLintOperationState.filePath) @@ -297,14 +313,14 @@ function createWatchProgram( return ts.createWatchProgram(watchCompilerHost); } -function hasTSConfigChanged(tsconfigPath: string): boolean { +function hasTSConfigChanged(tsconfigPath: CanonicalPath): boolean { const stat = fs.statSync(tsconfigPath); const lastModifiedAt = stat.mtimeMs; - const cachedLastModifiedAt = tsconfigLsatModifiedTimestampCache.get( + const cachedLastModifiedAt = tsconfigLastModifiedTimestampCache.get( tsconfigPath, ); - tsconfigLsatModifiedTimestampCache.set(tsconfigPath, lastModifiedAt); + tsconfigLastModifiedTimestampCache.set(tsconfigPath, lastModifiedAt); if (cachedLastModifiedAt === undefined) { return false; @@ -315,8 +331,8 @@ function hasTSConfigChanged(tsconfigPath: string): boolean { function maybeInvalidateProgram( existingWatch: ts.WatchOfConfigFile, - filePath: string, - tsconfigPath: string, + filePath: CanonicalPath, + tsconfigPath: CanonicalPath, ): ts.Program | null { /* * By calling watchProgram.getProgram(), it will trigger a resync of the program based on @@ -355,21 +371,22 @@ function maybeInvalidateProgram( log('File was not found in program - triggering folder update. %s', filePath); // Find the correct directory callback by climbing the folder tree - let current: string | null = null; - let next: string | null = path.dirname(filePath); + const currentDir = canonicalDirname(filePath); + let current: CanonicalPath | null = null; + let next = currentDir; let hasCallback = false; while (current !== next) { current = next; const folderWatchCallbacks = folderWatchCallbackTrackingMap.get(current); if (folderWatchCallbacks) { folderWatchCallbacks.forEach(cb => - cb(current!, ts.FileWatcherEventKind.Changed), + cb(currentDir, ts.FileWatcherEventKind.Changed), ); hasCallback = true; break; } - next = path.dirname(current); + next = canonicalDirname(current); } if (!hasCallback) { /* @@ -410,7 +427,9 @@ function maybeInvalidateProgram( return null; } - const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(deletedFile); + const fileWatchCallbacks = fileWatchCallbackTrackingMap.get( + getCanonicalFileName(deletedFile), + ); if (!fileWatchCallbacks) { // shouldn't happen, but just in case log('Could not find watch callbacks for root file. %s', deletedFile); diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index 3607a7fb897c..c210ddee43ee 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -18,10 +18,34 @@ const DEFAULT_COMPILER_OPTIONS: ts.CompilerOptions = { // extendedDiagnostics: true, }; -function getTsconfigPath(tsconfigPath: string, extra: Extra): string { - return path.isAbsolute(tsconfigPath) - ? tsconfigPath - : path.join(extra.tsconfigRootDir || process.cwd(), tsconfigPath); +// This narrows the type so we can be sure we're passing canonical names in the correct places +type CanonicalPath = string & { __brand: unknown }; +// typescript doesn't provide a ts.sys implementation for browser environments +const useCaseSensitiveFileNames = + ts.sys !== undefined ? ts.sys.useCaseSensitiveFileNames : true; +const getCanonicalFileName = useCaseSensitiveFileNames + ? (filePath: string): CanonicalPath => + path.normalize(filePath) as CanonicalPath + : (filePath: string): CanonicalPath => + path.normalize(filePath).toLowerCase() as CanonicalPath; + +function getTsconfigPath(tsconfigPath: string, extra: Extra): CanonicalPath { + return getCanonicalFileName( + path.isAbsolute(tsconfigPath) + ? tsconfigPath + : path.join(extra.tsconfigRootDir || process.cwd(), tsconfigPath), + ); +} + +function canonicalDirname(p: CanonicalPath): CanonicalPath { + return path.dirname(p) as CanonicalPath; } -export { ASTAndProgram, DEFAULT_COMPILER_OPTIONS, getTsconfigPath }; +export { + ASTAndProgram, + canonicalDirname, + CanonicalPath, + DEFAULT_COMPILER_OPTIONS, + getCanonicalFileName, + getTsconfigPath, +}; diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index c887193365f7..141ba25cce6a 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -16,11 +16,18 @@ import { TSESTree } from './ts-estree'; * This needs to be kept in sync with the top-level README.md in the * typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.8.0 || >3.7.0-dev.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.8.0'; +/* + * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one + * List them all separately here, so we can automatically create the full string + */ +const SUPPORTED_PRERELEASE_RANGES = ['>3.7.0-dev.0', '3.7.1-rc']; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, - SUPPORTED_TYPESCRIPT_VERSIONS, + [SUPPORTED_TYPESCRIPT_VERSIONS] + .concat(SUPPORTED_PRERELEASE_RANGES) + .join(' || '), ); let extra: Extra; @@ -225,17 +232,20 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { function warnAboutTSVersion(): void { if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { - const border = '============='; - const versionWarning = [ - border, - 'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.', - 'You may find that it works just fine, or you may not.', - `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, - `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, - 'Please only submit bug reports when using the officially supported version.', - border, - ]; - extra.log(versionWarning.join('\n\n')); + const isTTY = typeof process === undefined ? false : process.stdout.isTTY; + if (isTTY) { + const border = '============='; + const versionWarning = [ + border, + 'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.', + 'You may find that it works just fine, or you may not.', + `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, + `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, + 'Please only submit bug reports when using the officially supported version.', + border, + ]; + extra.log(versionWarning.join('\n\n')); + } warnedAboutTSVersion = true; } } diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index 178ed9efe59d..10cd0b7e0fb2 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -472,6 +472,7 @@ interface ClassPropertyBase extends BaseNode { value: Expression | null; computed: boolean; static: boolean; + declare: boolean; readonly?: boolean; decorators?: Decorator[]; accessibility?: Accessibility; 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 68639cb01b55..557ac0c11ce5 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -583,8 +583,11 @@ tester.addFixturePatternConfig('typescript/basics', { */ // optional chaining 'optional-chain', + 'optional-chain-with-parens', 'optional-chain-call', + 'optional-chain-call-with-parens', 'optional-chain-element-access', + 'optional-chain-element-access-with-parens', 'async-function-expression', 'class-with-accessibility-modifiers', 'class-with-mixin', @@ -605,6 +608,20 @@ tester.addFixturePatternConfig('typescript/basics', { 'type-assertion-with-guard-in-function', 'type-assertion-with-guard-in-interface', 'type-assertion-with-guard-in-method', + // declare class properties + 'abstract-class-with-abstract-properties', + 'abstract-class-with-abstract-readonly-property', + 'abstract-class-with-declare-properties', + 'class-with-declare-properties', + 'class-with-definite-assignment', + 'class-with-optional-computed-property', + 'class-with-optional-properties', + 'class-with-optional-property-undefined', + 'class-with-property-function', + 'class-with-property-values', + 'class-with-readonly-property', + 'object-with-escaped-properties', + 'type-reference-comments', ], ignoreSourceType: [ /** @@ -684,6 +701,9 @@ tester.addFixturePatternConfig('typescript/decorators/property-decorators', { // optional chaining 'property-decorator-factory-instance-member', 'property-decorator-factory-static-member', + // declare class properties + 'property-decorator-instance-member', + 'property-decorator-static-member', ], }); 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 645b6114f8ac..7454835c3ae1 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 @@ -1650,6 +1650,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-declare-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-optional-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-interface.src 1`] = ` @@ -1708,6 +1710,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-declare-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-definite-assignment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-export-parameter-properties.src 1`] = ` @@ -1918,8 +1922,14 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-call.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-call-with-parens.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-element-access.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-element-access-with-parens.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-with-parens.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/parenthesized-use-strict.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/readonly-arrays.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap index c1ba4580efde..f6b67ce5556a 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap @@ -1254,6 +1254,7 @@ Object { "body": Array [ Object { "computed": true, + "declare": false, "key": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index 44425c5e4a57..14b0a341b7a9 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -1607,6 +1607,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -1645,6 +1646,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -2017,6 +2019,7 @@ Object { Object { "accessibility": "public", "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -2362,220 +2365,421 @@ Object { } `; -exports[`typescript fixtures/basics/abstract-class-with-optional-method.src 1`] = ` +exports[`typescript fixtures/basics/abstract-class-with-declare-properties.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "abstract": true, - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "prop1", + "range": Array [ + 45, + 50, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 37, + 59, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 50, + 58, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 16, + "column": 23, "line": 2, }, "start": Object { - "column": 4, + "column": 17, "line": 2, }, }, - "name": "createSocket", - "optional": true, "range": Array [ - 43, - 55, + 52, + 58, ], - "type": "Identifier", + "type": "TSStringKeyword", }, - "kind": "method", + }, + "value": null, + }, + Object { + "computed": false, + "declare": true, + "key": Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 24, + "line": 3, }, "start": Object { - "column": 4, - "line": 2, + "column": 19, + "line": 3, }, }, + "name": "prop2", "range": Array [ - 43, - 76, + 79, + 84, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": null, + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 62, + 93, + ], + "static": false, + "type": "TSAbstractClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 84, + 92, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 32, + "line": 3, }, "start": Object { - "column": 17, - "line": 2, + "column": 26, + "line": 3, }, }, - "params": Array [], "range": Array [ - 56, - 76, + 86, + 92, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "name": "prop3", + "range": Array [ + 120, + 125, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 96, + 134, + ], + "static": false, + "type": "TSAbstractClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 125, + 133, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 4, }, - "range": Array [ - 58, - 75, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 60, - 75, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "name": "Promise", - "range": Array [ - 60, - 67, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "range": Array [ - 68, - 74, - ], - "type": "TSStringKeyword", - }, - ], - "range": Array [ - 67, - 75, - ], - "type": "TSTypeParameterInstantiation", - }, + "start": Object { + "column": 33, + "line": 4, }, }, - "type": "FunctionExpression", + "range": Array [ + 127, + 133, + ], + "type": "TSStringKeyword", }, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + "value": null, + }, + Object { + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 5, + }, + "start": Object { + "column": 28, + "line": 5, + }, + }, + "name": "prop4", + "range": Array [ + 163, + 168, + ], + "type": "Identifier", }, - "start": Object { - "column": 37, - "line": 1, + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 137, + 177, + ], + "readonly": true, + "static": false, + "type": "TSAbstractClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "range": Array [ + 168, + 176, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 35, + "line": 5, + }, + }, + "range": Array [ + 170, + 176, + ], + "type": "TSStringKeyword", + }, }, + "value": null, }, - "range": Array [ - 37, - 78, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "name": "prop5", + "range": Array [ + 213, + 218, + ], + "type": "Identifier", }, - "start": Object { - "column": 22, - "line": 1, + "loc": Object { + "end": Object { + "column": 49, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 180, + 227, + ], + "readonly": true, + "static": false, + "type": "TSAbstractClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 6, + }, + "start": Object { + "column": 40, + "line": 6, + }, + }, + "range": Array [ + 218, + 226, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "range": Array [ + 220, + 226, + ], + "type": "TSStringKeyword", + }, }, + "value": null, }, - "name": "AbstractSocket", - "range": Array [ - 22, - 36, - ], - "type": "Identifier", - }, + ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 7, }, "start": Object { - "column": 7, + "column": 33, "line": 1, }, }, "range": Array [ - 7, - 78, + 33, + 229, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "AbstractDeclProps", + "range": Array [ + 15, + 32, + ], + "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 7, }, "start": Object { "column": 0, @@ -2584,17 +2788,16 @@ Object { }, "range": Array [ 0, - 78, + 229, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -2603,14 +2806,14 @@ Object { }, "range": Array [ 0, - 78, + 230, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -2620,25 +2823,7 @@ Object { }, "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, + 8, ], "type": "Identifier", "value": "abstract", @@ -2646,17 +2831,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 14, "line": 1, }, "start": Object { - "column": 16, + "column": 9, "line": 1, }, }, "range": Array [ - 16, - 21, + 9, + 14, ], "type": "Keyword", "value": "class", @@ -2664,35 +2849,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, + "column": 32, "line": 1, }, "start": Object { - "column": 22, + "column": 15, "line": 1, }, }, "range": Array [ - 22, - 36, + 15, + 32, ], "type": "Identifier", - "value": "AbstractSocket", + "value": "AbstractDeclProps", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 34, "line": 1, }, "start": Object { - "column": 37, + "column": 33, "line": 1, }, }, "range": Array [ - 37, - 38, + 33, + 34, ], "type": "Punctuator", "value": "{", @@ -2700,83 +2885,83 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 9, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 43, - 55, + 37, + 44, ], "type": "Identifier", - "value": "createSocket", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 2, }, "start": Object { - "column": 16, + "column": 10, "line": 2, }, }, "range": Array [ - 55, - 56, + 45, + 50, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "prop1", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 2, }, "start": Object { - "column": 17, + "column": 15, "line": 2, }, }, "range": Array [ - 56, - 57, + 50, + 51, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 23, "line": 2, }, "start": Object { - "column": 18, + "column": 17, "line": 2, }, }, "range": Array [ - 57, + 52, 58, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 24, "line": 2, }, "start": Object { - "column": 19, + "column": 23, "line": 2, }, }, @@ -2785,246 +2970,166 @@ Object { 59, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 9, + "line": 3, }, "start": Object { - "column": 21, - "line": 2, + "column": 2, + "line": 3, }, }, "range": Array [ - 60, - 67, + 62, + 69, ], "type": "Identifier", - "value": "Promise", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 18, + "line": 3, }, "start": Object { - "column": 28, - "line": 2, + "column": 10, + "line": 3, }, }, "range": Array [ - 67, - 68, + 70, + 78, ], - "type": "Punctuator", - "value": "<", + "type": "Identifier", + "value": "abstract", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 2, + "column": 24, + "line": 3, }, "start": Object { - "column": 29, - "line": 2, + "column": 19, + "line": 3, }, }, "range": Array [ - 68, - 74, + 79, + 84, ], "type": "Identifier", - "value": "string", + "value": "prop2", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 25, + "line": 3, }, "start": Object { - "column": 35, - "line": 2, + "column": 24, + "line": 3, }, }, "range": Array [ - 74, - 75, + 84, + 85, ], "type": "Punctuator", - "value": ">", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 32, + "line": 3, }, "start": Object { - "column": 36, - "line": 2, + "column": 26, + "line": 3, }, }, "range": Array [ - 75, - 76, + 86, + 92, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 33, "line": 3, }, "start": Object { - "column": 0, + "column": 32, "line": 3, }, }, "range": Array [ - 77, - 78, + 92, + 93, ], "type": "Punctuator", - "value": "}", + "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/abstract-interface.src 1`] = ` -Object { - "body": Array [ Object { - "declaration": Object { - "abstract": true, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 31, - ], - "type": "TSInterfaceBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "I", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 31, - ], - "type": "TSInterfaceDeclaration", - }, "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 9, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 0, - 31, + 96, + 103, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "declare", }, - }, - "range": Array [ - 0, - 31, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 16, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 10, + "line": 4, }, }, "range": Array [ - 0, - 6, + 104, + 110, ], "type": "Keyword", - "value": "export", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 25, + "line": 4, }, "start": Object { - "column": 7, - "line": 1, + "column": 17, + "line": 4, }, }, "range": Array [ - 7, - 15, + 111, + 119, ], "type": "Identifier", "value": "abstract", @@ -3032,532 +3137,582 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 31, + "line": 4, }, "start": Object { - "column": 16, - "line": 1, + "column": 26, + "line": 4, }, }, "range": Array [ - 16, - 25, + 120, + 125, ], - "type": "Keyword", - "value": "interface", + "type": "Identifier", + "value": "prop3", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 32, + "line": 4, }, "start": Object { - "column": 26, - "line": 1, + "column": 31, + "line": 4, }, }, "range": Array [ - 26, - 27, + 125, + 126, ], - "type": "Identifier", - "value": "I", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 39, + "line": 4, }, "start": Object { - "column": 28, - "line": 1, + "column": 33, + "line": 4, }, }, "range": Array [ - 28, - 29, + 127, + 133, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 40, + "line": 4, }, "start": Object { - "column": 0, - "line": 2, + "column": 39, + "line": 4, }, }, "range": Array [ - 30, - 31, + 133, + 134, ], "type": "Punctuator", - "value": "}", + "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/angle-bracket-type-assertion.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 27, - ], - "type": "TSTypeAssertion", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 16, - ], - "type": "TSAnyKeyword", - }, - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 27, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 5, }, }, "range": Array [ - 0, - 28, + 137, + 144, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "declare", }, - }, - "range": Array [ - 0, - 29, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 18, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 10, + "line": 5, }, }, "range": Array [ - 0, - 5, + 145, + 153, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "readonly", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 27, + "line": 5, }, "start": Object { - "column": 6, - "line": 1, - }, + "column": 19, + "line": 5, + }, }, "range": Array [ - 6, - 9, + 154, + 162, ], "type": "Identifier", - "value": "foo", + "value": "abstract", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 33, + "line": 5, }, "start": Object { - "column": 10, - "line": 1, + "column": 28, + "line": 5, }, }, "range": Array [ - 10, - 11, + 163, + 168, + ], + "type": "Identifier", + "value": "prop4", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "range": Array [ + 168, + 169, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 41, + "line": 5, }, "start": Object { - "column": 12, - "line": 1, + "column": 35, + "line": 5, }, }, "range": Array [ - 12, - 13, + 170, + 176, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 41, + "line": 5, + }, + }, + "range": Array [ + 176, + 177, ], "type": "Punctuator", - "value": "<", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 9, + "line": 6, }, "start": Object { - "column": 13, - "line": 1, + "column": 2, + "line": 6, }, }, "range": Array [ - 13, - 16, + 180, + 187, ], "type": "Identifier", - "value": "any", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 188, + 194, + ], + "type": "Keyword", + "value": "public", }, Object { "loc": Object { "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { "column": 17, - "line": 1, + "line": 6, + }, + }, + "range": Array [ + 195, + 203, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 6, }, "start": Object { - "column": 16, - "line": 1, + "column": 26, + "line": 6, }, }, "range": Array [ - 16, - 17, + 204, + 212, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "range": Array [ + 213, + 218, + ], + "type": "Identifier", + "value": "prop5", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 6, + }, + "start": Object { + "column": 40, + "line": 6, + }, + }, + "range": Array [ + 218, + 219, ], "type": "Punctuator", - "value": ">", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 48, + "line": 6, }, "start": Object { - "column": 26, - "line": 1, + "column": 42, + "line": 6, }, }, "range": Array [ - 26, - 27, + 220, + 226, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 49, + "line": 6, }, "start": Object { - "column": 27, - "line": 1, + "column": 48, + "line": 6, }, }, "range": Array [ - 27, - 28, + 226, + 227, ], "type": "Punctuator", "value": ";", }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 228, + 229, + ], + "type": "Punctuator", + "value": "}", + }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/angle-bracket-type-assertion-arrow-function.src 1`] = ` +exports[`typescript fixtures/basics/abstract-class-with-optional-method.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "asserted2", - "range": Array [ - 4, - 13, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "name": "n", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 40, - ], - "type": "ReturnStatement", - }, - ], + "declaration": Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 4, + "line": 2, }, }, + "name": "createSocket", + "optional": true, "range": Array [ - 29, - 42, + 43, + 55, ], - "type": "BlockStatement", + "type": "Identifier", }, - "expression": false, - "generator": false, - "id": null, + "kind": "method", "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 37, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 4, + "line": 2, }, }, - "params": Array [ - Object { + "range": Array [ + 43, + 76, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 56, + 76, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 36, + "line": 2, }, "start": Object { - "column": 23, - "line": 1, + "column": 19, + "line": 2, }, }, - "name": "n", "range": Array [ - 23, - 24, + 58, + 75, ], - "type": "Identifier", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 60, + 75, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "Promise", + "range": Array [ + 60, + 67, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 67, + 75, + ], + "type": "TSTypeParameterInstantiation", + }, + }, }, - ], - "range": Array [ - 22, - 42, - ], - "type": "ArrowFunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, + "type": "FunctionExpression", }, }, - "range": Array [ - 16, - 43, - ], - "type": "TSTypeAssertion", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 20, - ], - "type": "TSAnyKeyword", + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, }, }, + "range": Array [ + 37, + 78, + ], + "type": "ClassBody", + }, + "id": Object { "loc": Object { "end": Object { - "column": 43, + "column": 36, "line": 1, }, "start": Object { - "column": 4, + "column": 22, "line": 1, }, }, + "name": "AbstractSocket", "range": Array [ - 4, - 43, + 22, + 36, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - ], - "kind": "var", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 78, + ], + "superClass": null, + "type": "ClassDeclaration", + }, "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -3566,15 +3721,17 @@ Object { }, "range": Array [ 0, - 44, + 78, ], - "type": "VariableDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -3583,14 +3740,14 @@ Object { }, "range": Array [ 0, - 45, + 78, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 6, "line": 1, }, "start": Object { @@ -3600,28 +3757,10 @@ Object { }, "range": Array [ 0, - 3, + 6, ], "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 13, - ], - "type": "Identifier", - "value": "asserted2", + "value": "export", }, Object { "loc": Object { @@ -3630,21 +3769,21 @@ Object { "line": 1, }, "start": Object { - "column": 14, + "column": 7, "line": 1, }, }, "range": Array [ - 14, + 7, 15, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "abstract", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 21, "line": 1, }, "start": Object { @@ -3654,115 +3793,115 @@ Object { }, "range": Array [ 16, - 17, + 21, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 36, "line": 1, }, "start": Object { - "column": 17, + "column": 22, "line": 1, }, }, "range": Array [ - 17, - 20, + 22, + 36, ], "type": "Identifier", - "value": "any", + "value": "AbstractSocket", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 38, "line": 1, }, "start": Object { - "column": 20, + "column": 37, "line": 1, }, }, "range": Array [ - 20, - 21, + 37, + 38, ], "type": "Punctuator", - "value": ">", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 21, - 22, + 43, + 55, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "createSocket", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 22, - 23, + 55, + 56, ], "type": "Punctuator", - "value": "(", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 23, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 23, - 24, + 56, + 57, ], - "type": "Identifier", - "value": "n", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 18, + "line": 2, }, }, "range": Array [ - 24, - 25, + 57, + 58, ], "type": "Punctuator", "value": ")", @@ -3770,276 +3909,196 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 26, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 26, - 28, + 58, + 59, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 28, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 29, - 30, + 60, + 67, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "Promise", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 31, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 31, - 37, + 67, + 68, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 35, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 29, + "line": 2, }, }, "range": Array [ - 38, - 39, + 68, + 74, ], "type": "Identifier", - "value": "n", - }, - Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": ";", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 36, + "line": 2, }, "start": Object { - "column": 41, - "line": 1, + "column": 35, + "line": 2, }, }, "range": Array [ - 41, - 42, + 74, + 75, ], "type": "Punctuator", - "value": "}", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 37, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 36, + "line": 2, }, }, "range": Array [ - 42, - 43, + 75, + 76, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 43, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 43, - 44, + 77, + 78, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/arrow-function-with-optional-parameter.src 1`] = ` +exports[`typescript fixtures/basics/abstract-interface.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "async": false, - "body": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "k", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "declaration": Object { + "abstract": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, }, - "operator": "+", - "range": Array [ - 9, - 14, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "raw": "1", - "type": "Literal", - "value": 1, + "start": Object { + "column": 28, + "line": 1, }, - "type": "BinaryExpression", }, - "expression": true, - "generator": false, - "id": null, + "range": Array [ + 28, + 31, + ], + "type": "TSInterfaceBody", + }, + "id": Object { "loc": Object { "end": Object { - "column": 14, + "column": 27, "line": 1, }, "start": Object { - "column": 1, + "column": 26, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "name": "k", - "optional": true, - "range": Array [ - 2, - 4, - ], - "type": "Identifier", - }, - ], + "name": "I", "range": Array [ - 1, - 14, + 26, + 27, ], - "type": "ArrowFunctionExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 2, }, "start": Object { - "column": 0, + "column": 7, "line": 1, }, }, - "optional": false, "range": Array [ - 0, - 17, + 7, + 31, ], - "type": "CallExpression", + "type": "TSInterfaceDeclaration", }, "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 1, + "line": 2, }, "start": Object { "column": 0, @@ -4048,14 +4107,16 @@ Object { }, "range": Array [ 0, - 18, + 31, ], - "type": "ExpressionStatement", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, + "column": 1, "line": 2, }, "start": Object { @@ -4065,14 +4126,14 @@ Object { }, "range": Array [ 0, - 19, + 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 6, "line": 1, }, "start": Object { @@ -4082,172 +4143,305 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 2, + 6, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 15, "line": 1, }, "start": Object { - "column": 2, + "column": 7, "line": 1, }, }, "range": Array [ - 2, - 3, + 7, + 15, ], "type": "Identifier", - "value": "k", + "value": "abstract", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 25, "line": 1, }, "start": Object { - "column": 3, + "column": 16, "line": 1, }, }, "range": Array [ - 3, - 4, + 16, + 25, ], - "type": "Punctuator", - "value": "?", + "type": "Keyword", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 27, "line": 1, }, "start": Object { - "column": 4, + "column": 26, "line": 1, }, }, "range": Array [ - 4, - 5, + 26, + 27, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "I", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 29, "line": 1, }, "start": Object { - "column": 6, + "column": 28, "line": 1, }, }, "range": Array [ - 6, - 8, + 28, + 29, ], "type": "Punctuator", - "value": "=>", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - "value": "k", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 1, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 2, }, }, "range": Array [ - 11, - 12, + 30, + 31, ], "type": "Punctuator", - "value": "+", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/angle-bracket-type-assertion.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 27, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "TSAnyKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, }, "range": Array [ - 13, - 14, + 0, + 28, ], - "type": "Numeric", - "value": "1", + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 15, + "column": 5, "line": 1, }, "start": Object { - "column": 14, + "column": 0, "line": 1, }, }, "range": Array [ - 14, - 15, + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, ], "type": "Punctuator", - "value": ")", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { @@ -4256,16 +4450,16 @@ Object { "line": 1, }, "start": Object { - "column": 15, + "column": 13, "line": 1, }, }, "range": Array [ - 15, + 13, 16, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { @@ -4283,22 +4477,40 @@ Object { 17, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 27, "line": 1, }, "start": Object { - "column": 17, + "column": 26, "line": 1, }, }, "range": Array [ - 17, - 18, + 26, + 27, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, ], "type": "Punctuator", "value": ";", @@ -4308,84 +4520,16 @@ Object { } `; -exports[`typescript fixtures/basics/arrow-function-with-type-parameters.src 1`] = ` +exports[`typescript fixtures/basics/angle-bracket-type-assertion-arrow-function.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "b", - "range": Array [ - 29, - 30, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 22, - 31, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 33, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 8, + "column": 13, "line": 1, }, "start": Object { @@ -4393,182 +4537,164 @@ Object { "line": 1, }, }, - "name": "b", + "name": "asserted2", "range": Array [ 4, - 8, + 13, ], "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 8, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + }, + "init": Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "n", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 40, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 8, + "column": 42, "line": 1, }, "start": Object { - "column": 7, + "column": 29, "line": 1, }, }, "range": Array [ - 7, - 8, + 29, + 42, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 8, + "column": 24, "line": 1, }, "start": Object { - "column": 7, + "column": 23, "line": 1, }, }, - "name": "X", + "name": "n", "range": Array [ - 7, - 8, + 23, + 24, ], "type": "Identifier", }, - }, - }, - }, - ], - "range": Array [ - 0, - 33, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + ], + "range": Array [ + 22, + 42, + ], + "type": "ArrowFunctionExpression", }, - }, - "range": Array [ - 9, - 12, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 12, + "column": 43, "line": 1, }, "start": Object { - "column": 11, + "column": 16, "line": 1, }, }, "range": Array [ - 11, - 12, + 16, + 43, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSTypeAssertion", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 12, + "column": 20, "line": 1, }, "start": Object { - "column": 11, + "column": 17, "line": 1, }, }, - "name": "X", "range": Array [ - 11, - 12, + 17, + 20, ], - "type": "Identifier", + "type": "TSAnyKeyword", }, }, - }, - "type": "ArrowFunctionExpression", - "typeParameters": Object { "loc": Object { "end": Object { - "column": 3, + "column": 43, "line": 1, }, "start": Object { - "column": 0, + "column": 4, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "X", - "range": Array [ - 1, - 2, - ], - "type": "Identifier", - }, - "range": Array [ - 1, - 2, - ], - "type": "TSTypeParameter", - }, - ], "range": Array [ - 0, - 3, + 4, + 43, ], - "type": "TSTypeParameterDeclaration", + "type": "VariableDeclarator", }, - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 44, + "line": 1, }, "start": Object { "column": 0, @@ -4577,15 +4703,15 @@ Object { }, "range": Array [ 0, - 33, + 44, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -4594,14 +4720,14 @@ Object { }, "range": Array [ 0, - 33, + 45, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 3, "line": 1, }, "start": Object { @@ -4611,187 +4737,187 @@ Object { }, "range": Array [ 0, - 1, + 3, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 13, "line": 1, }, "start": Object { - "column": 1, + "column": 4, "line": 1, }, }, "range": Array [ - 1, - 2, + 4, + 13, ], "type": "Identifier", - "value": "X", + "value": "asserted2", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 15, "line": 1, }, "start": Object { - "column": 2, + "column": 14, "line": 1, }, }, "range": Array [ - 2, - 3, + 14, + 15, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 17, "line": 1, }, "start": Object { - "column": 3, + "column": 16, "line": 1, }, }, "range": Array [ - 3, - 4, + 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 17, "line": 1, }, }, "range": Array [ - 4, - 5, + 17, + 20, ], "type": "Identifier", - "value": "b", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 21, "line": 1, }, "start": Object { - "column": 5, + "column": 20, "line": 1, }, }, "range": Array [ - 5, - 6, + 20, + 21, ], "type": "Punctuator", - "value": ":", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 22, "line": 1, }, "start": Object { - "column": 7, + "column": 21, "line": 1, }, }, "range": Array [ - 7, - 8, + 21, + 22, ], - "type": "Identifier", - "value": "X", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 23, "line": 1, }, "start": Object { - "column": 8, + "column": 22, "line": 1, }, }, "range": Array [ - 8, - 9, + 22, + 23, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 24, "line": 1, }, "start": Object { - "column": 9, + "column": 23, "line": 1, }, }, "range": Array [ - 9, - 10, + 23, + 24, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "n", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 25, "line": 1, }, "start": Object { - "column": 11, + "column": 24, "line": 1, }, }, "range": Array [ - 11, - 12, + 24, + 25, ], - "type": "Identifier", - "value": "X", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 28, "line": 1, }, "start": Object { - "column": 13, + "column": 26, "line": 1, }, }, "range": Array [ - 13, - 15, + 26, + 28, ], "type": "Punctuator", "value": "=>", @@ -4799,17 +4925,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 30, "line": 1, }, "start": Object { - "column": 16, + "column": 29, "line": 1, }, }, "range": Array [ - 16, - 17, + 29, + 30, ], "type": "Punctuator", "value": "{", @@ -4817,17 +4943,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 37, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 31, + "line": 1, }, }, "range": Array [ - 22, - 28, + 31, + 37, ], "type": "Keyword", "value": "return", @@ -4835,35 +4961,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 39, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 38, + "line": 1, }, }, "range": Array [ - 29, - 30, + 38, + 39, ], "type": "Identifier", - "value": "b", + "value": "n", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 40, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 39, + "line": 1, }, }, "range": Array [ - 30, - 31, + 39, + 40, ], "type": "Punctuator", "value": ";", @@ -4871,93 +4997,169 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 42, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 41, + "line": 1, }, }, "range": Array [ - 32, - 33, + 41, + 42, ], "type": "Punctuator", "value": "}", }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/async-function-expression.src 1`] = ` +exports[`typescript fixtures/basics/arrow-function-with-optional-parameter.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "arguments": Array [], "callee": Object { - "async": true, + "async": false, "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 1, + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, + "name": "k", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", }, - "range": Array [ - 23, - 26, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { "loc": Object { "end": Object { - "column": 20, + "column": 14, "line": 1, }, "start": Object { - "column": 16, + "column": 9, "line": 1, }, }, - "name": "test", + "operator": "+", "range": Array [ - 16, - 20, + 9, + 14, ], - "type": "Identifier", + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", }, + "expression": true, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { "column": 1, "line": 1, }, }, - "params": Array [], + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "k", + "optional": true, + "range": Array [ + 2, + 4, + ], + "type": "Identifier", + }, + ], "range": Array [ 1, - 26, + 14, ], - "type": "FunctionExpression", + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { "column": 0, @@ -4967,14 +5169,14 @@ Object { "optional": false, "range": Array [ 0, - 29, + 17, ], "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { "column": 0, @@ -4983,14 +5185,14 @@ Object { }, "range": Array [ 0, - 30, + 18, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 5, + "column": 0, "line": 2, }, "start": Object { @@ -5000,7 +5202,7 @@ Object { }, "range": Array [ 0, - 30, + 19, ], "sourceType": "script", "tokens": Array [ @@ -5025,7 +5227,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 2, "line": 1, }, "start": Object { @@ -5035,133 +5237,151 @@ Object { }, "range": Array [ 1, - 6, + 2, ], - "type": "Identifier", - "value": "async", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 3, "line": 1, }, "start": Object { - "column": 7, + "column": 2, "line": 1, }, }, "range": Array [ - 7, - 15, + 2, + 3, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "k", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 4, "line": 1, }, "start": Object { - "column": 16, + "column": 3, "line": 1, }, }, "range": Array [ - 16, - 20, + 3, + 4, ], - "type": "Identifier", - "value": "test", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 5, "line": 1, }, "start": Object { - "column": 20, + "column": 4, "line": 1, }, }, "range": Array [ - 20, - 21, + 4, + 5, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 8, "line": 1, }, "start": Object { - "column": 21, + "column": 6, "line": 1, }, }, "range": Array [ - 21, - 22, + 6, + 8, ], "type": "Punctuator", - "value": ")", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 10, "line": 1, }, "start": Object { - "column": 23, + "column": 9, "line": 1, }, }, "range": Array [ - 23, - 24, + 9, + 10, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "k", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 25, - 26, + 11, + 12, ], "type": "Punctuator", - "value": "}", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 1, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 26, - 27, + 13, + 14, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, ], "type": "Punctuator", "value": ")", @@ -5169,17 +5389,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 15, + "line": 1, }, }, "range": Array [ - 27, - 28, + 15, + 16, ], "type": "Punctuator", "value": "(", @@ -5187,17 +5407,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 3, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ - 28, - 29, + 16, + 17, ], "type": "Punctuator", "value": ")", @@ -5205,17 +5425,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 1, }, }, "range": Array [ - 29, - 30, + 17, + 18, ], "type": "Punctuator", "value": ";", @@ -5225,34 +5445,951 @@ Object { } `; -exports[`typescript fixtures/basics/async-function-with-var-declaration.src 1`] = ` +exports[`typescript fixtures/basics/arrow-function-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, }, - "name": "foo", - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 31, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 33, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 33, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + }, + }, + "type": "ArrowFunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + "range": Array [ + 1, + 2, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 0, + 3, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "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": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + 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": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/async-function-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 26, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 29, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Identifier", + "value": "async", + }, + 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": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + "value": "test", + }, + 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, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/async-function-with-var-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, "init": Object { "loc": Object { "end": Object { @@ -9797,6 +10934,7 @@ Object { Object { "accessibility": "private", "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -9870,6 +11008,7 @@ Object { Object { "accessibility": "public", "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -13112,7 +14251,7 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-definite-assignment.src 1`] = ` +exports[`typescript fixtures/basics/class-with-declare-properties.src 1`] = ` Object { "body": Array [ Object { @@ -13120,28 +14259,28 @@ Object { "body": Array [ Object { "computed": false, - "definite": true, + "declare": true, "key": Object { "loc": Object { "end": Object { - "column": 3, + "column": 15, "line": 2, }, "start": Object { - "column": 2, + "column": 10, "line": 2, }, }, - "name": "a", + "name": "prop1", "range": Array [ - 12, - 13, + 28, + 33, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 13, + "column": 24, "line": 2, }, "start": Object { @@ -13150,41 +14289,486 @@ Object { }, }, "range": Array [ - 12, - 23, + 20, + 42, ], "static": false, "type": "ClassProperty", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 2, }, "start": Object { - "column": 4, + "column": 15, "line": 2, }, }, "range": Array [ - 14, - 22, + 33, + 41, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 2, }, "start": Object { - "column": 6, + "column": 17, "line": 2, }, }, "range": Array [ - 16, - 22, + 35, + 41, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "name": "prop2", + "range": Array [ + 60, + 65, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 45, + 74, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 65, + 73, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 67, + 73, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "name": "prop3", + "range": Array [ + 92, + 97, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 77, + 106, + ], + "static": true, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 97, + 105, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 99, + 105, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "name": "prop3", + "range": Array [ + 126, + 131, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 109, + 140, + ], + "readonly": true, + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 131, + 139, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 5, + }, + "start": Object { + "column": 26, + "line": 5, + }, + }, + "range": Array [ + 133, + 139, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 6, + }, + "start": Object { + "column": 26, + "line": 6, + }, + }, + "name": "prop4", + "range": Array [ + 167, + 172, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 143, + 181, + ], + "readonly": true, + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 6, + }, + "start": Object { + "column": 31, + "line": 6, + }, + }, + "range": Array [ + 172, + 180, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 174, + 180, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 7, + }, + "start": Object { + "column": 24, + "line": 7, + }, + }, + "name": "prop5", + "range": Array [ + 206, + 211, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 184, + 220, + ], + "static": true, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 7, + }, + "start": Object { + "column": 29, + "line": 7, + }, + }, + "range": Array [ + 211, + 219, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 7, + }, + "start": Object { + "column": 31, + "line": 7, + }, + }, + "range": Array [ + 213, + 219, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 8, + }, + "start": Object { + "column": 33, + "line": 8, + }, + }, + "name": "prop6", + "range": Array [ + 254, + 259, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 223, + 268, + ], + "readonly": true, + "static": true, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 8, + }, + "start": Object { + "column": 38, + "line": 8, + }, + }, + "range": Array [ + 259, + 267, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 8, + }, + "start": Object { + "column": 40, + "line": 8, + }, + }, + "range": Array [ + 261, + 267, ], "type": "TSStringKeyword", }, @@ -13195,23 +14779,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 9, }, "start": Object { - "column": 8, + "column": 16, "line": 1, }, }, "range": Array [ - 8, - 25, + 16, + 270, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 15, "line": 1, }, "start": Object { @@ -13219,17 +14803,17 @@ Object { "line": 1, }, }, - "name": "X", + "name": "DeclProps", "range": Array [ 6, - 7, + 15, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 9, }, "start": Object { "column": 0, @@ -13238,7 +14822,7 @@ Object { }, "range": Array [ 0, - 25, + 270, ], "superClass": null, "type": "ClassDeclaration", @@ -13247,7 +14831,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 10, }, "start": Object { "column": 0, @@ -13256,7 +14840,7 @@ Object { }, "range": Array [ 0, - 26, + 271, ], "sourceType": "script", "tokens": Array [ @@ -13281,7 +14865,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 15, "line": 1, }, "start": Object { @@ -13291,25 +14875,25 @@ Object { }, "range": Array [ 6, - 7, + 15, ], "type": "Identifier", - "value": "X", + "value": "DeclProps", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 17, "line": 1, }, "start": Object { - "column": 8, + "column": 16, "line": 1, }, }, "range": Array [ - 8, - 9, + 16, + 17, ], "type": "Punctuator", "value": "{", @@ -13317,7 +14901,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 9, "line": 2, }, "start": Object { @@ -13326,44 +14910,44 @@ Object { }, }, "range": Array [ - 12, - 13, + 20, + 27, ], "type": "Identifier", - "value": "a", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 15, "line": 2, }, "start": Object { - "column": 3, + "column": 10, "line": 2, }, }, "range": Array [ - 13, - 14, + 28, + 33, ], - "type": "Punctuator", - "value": "!", + "type": "Identifier", + "value": "prop1", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 16, "line": 2, }, "start": Object { - "column": 4, + "column": 15, "line": 2, }, }, "range": Array [ - 14, - 15, + 33, + 34, ], "type": "Punctuator", "value": ":", @@ -13371,17 +14955,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 2, }, "start": Object { - "column": 6, + "column": 17, "line": 2, }, }, "range": Array [ - 16, - 22, + 35, + 41, ], "type": "Identifier", "value": "string", @@ -13389,17 +14973,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 24, "line": 2, }, "start": Object { - "column": 12, + "column": 23, "line": 2, }, }, "range": Array [ - 22, - 23, + 41, + 42, ], "type": "Punctuator", "value": ";", @@ -13407,390 +14991,287 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, + "column": 9, "line": 3, }, "start": Object { - "column": 0, + "column": 2, "line": 3, }, }, "range": Array [ - 24, - 25, + 45, + 52, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "declare", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-export-parameter-properties.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "constructor", - "range": Array [ - 16, - 27, - ], - "type": "Identifier", - }, - "kind": "constructor", - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 16, - 54, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 46, - 54, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "params": Array [ - Object { - "export": true, - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "a", - "range": Array [ - 35, - 44, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "range": Array [ - 36, - 44, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 26, - "line": 2, - }, - }, - "range": Array [ - 38, - 44, - ], - "type": "TSStringKeyword", - }, - }, - }, - "range": Array [ - 28, - 44, - ], - "type": "TSParameterProperty", - }, - ], - "range": Array [ - 27, - 54, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, }, - "range": Array [ - 10, - 56, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 10, + "line": 3, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, + "range": Array [ + 53, + 59, + ], + "type": "Keyword", + "value": "public", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 22, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 3, }, }, "range": Array [ - 0, - 56, + 60, + 65, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Identifier", + "value": "prop2", }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 7, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ":", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 67, + 73, + ], + "type": "Identifier", + "value": "string", }, - }, - "range": Array [ - 0, - 58, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 31, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 30, + "line": 3, }, }, "range": Array [ - 0, - 5, + 73, + 74, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 1, + "line": 4, }, "start": Object { - "column": 6, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 6, - 9, + 77, + 84, ], "type": "Identifier", - "value": "Foo", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 16, + "line": 4, }, "start": Object { "column": 10, - "line": 1, + "line": 4, }, }, "range": Array [ - 10, - 11, + 85, + 91, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 92, + 97, + ], + "type": "Identifier", + "value": "prop3", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 97, + 98, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 30, + "line": 4, }, "start": Object { - "column": 4, - "line": 2, + "column": 24, + "line": 4, }, }, "range": Array [ - 16, - 27, + 99, + 105, ], "type": "Identifier", - "value": "constructor", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 31, + "line": 4, }, "start": Object { - "column": 15, - "line": 2, + "column": 30, + "line": 4, }, }, "range": Array [ - 27, - 28, + 105, + 106, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 9, + "line": 5, }, "start": Object { - "column": 16, - "line": 2, + "column": 2, + "line": 5, }, }, "range": Array [ - 28, - 34, + 109, + 116, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 117, + 125, + ], + "type": "Identifier", + "value": "readonly", }, Object { "loc": Object { "end": Object { "column": 24, - "line": 2, + "line": 5, }, "start": Object { - "column": 23, - "line": 2, + "column": 19, + "line": 5, }, }, "range": Array [ - 35, - 36, + 126, + 131, ], "type": "Identifier", - "value": "a", + "value": "prop3", }, Object { "loc": Object { "end": Object { "column": 25, - "line": 2, + "line": 5, }, "start": Object { "column": 24, - "line": 2, + "line": 5, }, }, "range": Array [ - 36, - 37, + 131, + 132, ], "type": "Punctuator", "value": ":", @@ -13799,16 +15280,16 @@ Object { "loc": Object { "end": Object { "column": 32, - "line": 2, + "line": 5, }, "start": Object { "column": 26, - "line": 2, + "line": 5, }, }, "range": Array [ - 38, - 44, + 133, + 139, ], "type": "Identifier", "value": "string", @@ -13817,767 +15298,430 @@ Object { "loc": Object { "end": Object { "column": 33, - "line": 2, + "line": 5, }, "start": Object { "column": 32, - "line": 2, + "line": 5, }, }, "range": Array [ - 44, - 45, + 139, + 140, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 2, + "column": 9, + "line": 6, }, "start": Object { - "column": 34, - "line": 2, + "column": 2, + "line": 6, }, }, "range": Array [ - 46, - 47, + 143, + 150, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 16, + "line": 6, }, "start": Object { - "column": 4, - "line": 4, + "column": 10, + "line": 6, }, }, "range": Array [ - 53, - 54, + 151, + 157, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 25, + "line": 6, }, "start": Object { - "column": 0, - "line": 5, + "column": 17, + "line": 6, }, }, "range": Array [ - 55, - 56, + 158, + 166, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "readonly", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-extends-and-implements.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 80, - "line": 1, - }, - "start": Object { - "column": 78, - "line": 1, - }, - }, - "range": Array [ - 78, - 80, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "ClassWithParentAndInterface", - "range": Array [ - 6, - 33, - ], - "type": "Identifier", - }, - "implements": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 77, - "line": 1, - }, - "start": Object { - "column": 66, - "line": 1, - }, - }, - "name": "MyInterface", - "range": Array [ - 66, - 77, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 77, - "line": 1, - }, - "start": Object { - "column": 66, - "line": 1, - }, - }, - "range": Array [ - 66, - 77, - ], - "type": "TSClassImplements", - }, - ], "loc": Object { "end": Object { - "column": 80, - "line": 1, + "column": 31, + "line": 6, }, "start": Object { - "column": 0, - "line": 1, + "column": 26, + "line": 6, }, }, "range": Array [ - 0, - 80, + 167, + 172, ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 1, - }, - "start": Object { - "column": 42, - "line": 1, - }, - }, - "name": "MyOtherClass", - "range": Array [ - 42, - 54, - ], - "type": "Identifier", - }, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "prop4", }, - }, - "range": Array [ - 0, - 81, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 32, + "line": 6, }, "start": Object { - "column": 0, - "line": 1, + "column": 31, + "line": 6, }, }, "range": Array [ - 0, - 5, + 172, + 173, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 39, + "line": 6, }, "start": Object { - "column": 6, - "line": 1, + "column": 33, + "line": 6, }, }, "range": Array [ - 6, - 33, + 174, + 180, ], "type": "Identifier", - "value": "ClassWithParentAndInterface", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 40, + "line": 6, }, "start": Object { - "column": 34, - "line": 1, + "column": 39, + "line": 6, }, }, "range": Array [ - 34, - 41, + 180, + 181, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 54, - "line": 1, + "column": 9, + "line": 7, }, "start": Object { - "column": 42, - "line": 1, + "column": 2, + "line": 7, }, }, "range": Array [ - 42, - 54, + 184, + 191, ], "type": "Identifier", - "value": "MyOtherClass", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 65, - "line": 1, + "column": 16, + "line": 7, }, "start": Object { - "column": 55, - "line": 1, + "column": 10, + "line": 7, }, }, "range": Array [ - 55, - 65, + 192, + 198, ], "type": "Keyword", - "value": "implements", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 77, - "line": 1, + "column": 23, + "line": 7, }, "start": Object { - "column": 66, - "line": 1, + "column": 17, + "line": 7, }, }, "range": Array [ - 66, - 77, + 199, + 205, ], - "type": "Identifier", - "value": "MyInterface", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 79, - "line": 1, + "column": 29, + "line": 7, }, "start": Object { - "column": 78, - "line": 1, + "column": 24, + "line": 7, }, }, "range": Array [ - 78, - 79, + 206, + 211, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "prop5", }, Object { "loc": Object { "end": Object { - "column": 80, - "line": 1, + "column": 30, + "line": 7, }, "start": Object { - "column": 79, - "line": 1, + "column": 29, + "line": 7, }, }, "range": Array [ - 79, - 80, + 211, + 212, ], "type": "Punctuator", - "value": "}", + "value": ":", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-extends-generic.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 32, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 37, + "line": 7, }, "start": Object { - "column": 0, - "line": 1, + "column": 31, + "line": 7, }, }, "range": Array [ - 0, - 32, + 213, + 219, ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "superTypeParameters": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "B", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 24, - 27, - ], - "type": "TSTypeParameterInstantiation", - }, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 10, - 11, - ], - "type": "Identifier", - }, - "range": Array [ - 10, - 11, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 9, - 12, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "string", }, - }, - "range": Array [ - 0, - 33, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 38, + "line": 7, }, "start": Object { - "column": 0, - "line": 1, + "column": 37, + "line": 7, }, }, "range": Array [ - 0, - 5, + 219, + 220, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 1, + "line": 8, }, "start": Object { - "column": 6, - "line": 1, + "column": 2, + "line": 8, }, }, "range": Array [ - 6, - 9, + 223, + 230, ], "type": "Identifier", - "value": "Foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Punctuator", - "value": "<", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 16, + "line": 8, }, "start": Object { "column": 10, - "line": 1, + "line": 8, }, }, "range": Array [ - 10, - 11, + 231, + 237, ], - "type": "Identifier", - "value": "A", + "type": "Keyword", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 23, + "line": 8, }, "start": Object { - "column": 11, - "line": 1, + "column": 17, + "line": 8, }, }, "range": Array [ - 11, - 12, + 238, + 244, ], - "type": "Punctuator", - "value": ">", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 32, + "line": 8, }, "start": Object { - "column": 13, - "line": 1, + "column": 24, + "line": 8, }, }, "range": Array [ - 13, - 20, + 245, + 253, ], - "type": "Keyword", - "value": "extends", + "type": "Identifier", + "value": "readonly", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 38, + "line": 8, }, "start": Object { - "column": 21, - "line": 1, + "column": 33, + "line": 8, }, }, "range": Array [ - 21, - 24, + 254, + 259, ], "type": "Identifier", - "value": "Bar", + "value": "prop6", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 39, + "line": 8, }, "start": Object { - "column": 24, - "line": 1, + "column": 38, + "line": 8, }, }, "range": Array [ - 24, - 25, + 259, + 260, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 46, + "line": 8, }, "start": Object { - "column": 25, - "line": 1, + "column": 40, + "line": 8, }, }, "range": Array [ - 25, - 26, + 261, + 267, ], "type": "Identifier", - "value": "B", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": ">", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 47, + "line": 8, }, "start": Object { - "column": 28, - "line": 1, + "column": 46, + "line": 8, }, }, "range": Array [ - 28, - 29, + 267, + 268, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 9, }, "start": Object { "column": 0, - "line": 3, + "line": 9, }, }, "range": Array [ - 31, - 32, + 269, + 270, ], "type": "Punctuator", "value": "}", @@ -14587,257 +15731,137 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-extends-generic-multiple.src 1`] = ` +exports[`typescript fixtures/basics/class-with-definite-assignment.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "range": Array [ - 41, - 45, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 45, - ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 31, - 34, - ], - "type": "Identifier", - }, - "superTypeParameters": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "params": Array [ + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 36, - ], - "type": "TSTypeReference", - "typeName": Object { + "computed": false, + "declare": false, + "definite": true, + "key": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 35, - "line": 1, + "column": 2, + "line": 2, }, }, - "name": "C", + "name": "a", "range": Array [ - 35, - 36, + 12, + 13, ], "type": "Identifier", }, - }, - Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 38, - 39, + 12, + 23, ], - "type": "TSTypeReference", - "typeName": Object { + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 4, + "line": 2, }, }, - "name": "D", "range": Array [ - 38, - 39, + 14, + 22, ], - "type": "Identifier", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "TSStringKeyword", + }, }, + "value": null, }, ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, "range": Array [ - 34, - 40, + 8, + 25, ], - "type": "TSTypeParameterInstantiation", + "type": "ClassBody", }, - "type": "ClassDeclaration", - "typeParameters": Object { + "id": Object { "loc": Object { "end": Object { - "column": 22, + "column": 7, "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, - "params": Array [ - Object { - "constraint": 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": "B", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 10, - 11, - ], - "type": "Identifier", - }, - "range": Array [ - 10, - 21, - ], - "type": "TSTypeParameter", - }, - ], + "name": "X", "range": Array [ - 9, - 22, + 6, + 7, ], - "type": "TSTypeParameterDeclaration", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 25, + ], + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { @@ -14852,7 +15876,7 @@ Object { }, "range": Array [ 0, - 46, + 26, ], "sourceType": "script", "tokens": Array [ @@ -14877,7 +15901,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { @@ -14887,271 +15911,145 @@ Object { }, "range": Array [ 6, - 9, + 7, ], "type": "Identifier", - "value": "Foo", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 9, "line": 1, }, "start": Object { - "column": 9, + "column": 8, "line": 1, }, }, "range": Array [ + 8, 9, - 10, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 10, - 11, + 12, + 13, ], "type": "Identifier", - "value": "A", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 4, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 3, + "line": 2, }, }, "range": Array [ - 12, - 19, + 13, + 14, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 20, - 21, + 14, + 15, ], - "type": "Identifier", - "value": "B", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 6, + "line": 2, }, }, "range": Array [ - 21, + 16, 22, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 23, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ + 22, 23, - 30, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 31, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 31, - 34, + 24, + 25, ], - "type": "Identifier", - "value": "Bar", + "type": "Punctuator", + "value": "}", }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "range": Array [ - 34, - 35, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - "value": "C", - }, - 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": 39, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - "value": "D", - }, - Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "range": Array [ - 41, - 42, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 44, - 45, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-generic-method.src 1`] = ` -Object { - "body": Array [ + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-export-parameter-properties.src 1`] = ` +Object { + "body": Array [ Object { "body": Object { "body": Array [ @@ -15160,35 +16058,35 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 8, + "column": 15, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, - "name": "getBar", + "name": "constructor", "range": Array [ - 14, - 20, + 16, + 27, ], "type": "Identifier", }, - "kind": "method", + "kind": "constructor", "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ - 14, - 28, + 16, + 54, ], "static": false, "type": "MethodDefinition", @@ -15198,17 +16096,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 14, + "column": 34, "line": 2, }, }, "range": Array [ - 26, - 28, + 46, + 54, ], "type": "BlockStatement", }, @@ -15217,81 +16115,98 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 8, + "column": 15, "line": 2, }, }, - "params": Array [], - "range": Array [ - 20, - 28, - ], - "type": "FunctionExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, + "params": Array [ + Object { + "export": true, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, }, - }, - "params": Array [ - Object { + "parameter": Object { "loc": Object { "end": Object { - "column": 10, + "column": 32, "line": 2, }, "start": Object { - "column": 9, + "column": 23, "line": 2, }, }, - "name": Object { + "name": "a", + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 10, + "column": 32, "line": 2, }, "start": Object { - "column": 9, + "column": 24, "line": 2, }, }, - "name": "T", "range": Array [ - 21, - 22, + 36, + 44, ], - "type": "Identifier", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TSStringKeyword", + }, }, - "range": Array [ - 21, - 22, - ], - "type": "TSTypeParameter", }, - ], - "range": Array [ - 20, - 23, - ], - "type": "TSTypeParameterDeclaration", - }, + "range": Array [ + 28, + 44, + ], + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 27, + 54, + ], + "type": "FunctionExpression", }, }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 10, @@ -15300,7 +16215,7 @@ Object { }, "range": Array [ 10, - 30, + 56, ], "type": "ClassBody", }, @@ -15325,7 +16240,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -15334,7 +16249,7 @@ Object { }, "range": Array [ 0, - 30, + 56, ], "superClass": null, "type": "ClassDeclaration", @@ -15343,7 +16258,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 7, }, "start": Object { "column": 0, @@ -15352,7 +16267,7 @@ Object { }, "range": Array [ 0, - 31, + 58, ], "sourceType": "script", "tokens": Array [ @@ -15413,107 +16328,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 15, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ - 14, - 20, + 16, + 27, ], "type": "Identifier", - "value": "getBar", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 2, }, "start": Object { - "column": 8, + "column": 15, "line": 2, }, }, "range": Array [ - 20, - 21, + 27, + 28, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 22, "line": 2, }, "start": Object { - "column": 9, + "column": 16, "line": 2, }, }, "range": Array [ - 21, - 22, + 28, + 34, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, ], "type": "Identifier", - "value": "T", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 25, "line": 2, }, "start": Object { - "column": 10, + "column": 24, "line": 2, }, }, "range": Array [ - 22, - 23, + 36, + 37, ], "type": "Punctuator", - "value": ">", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 32, "line": 2, }, "start": Object { - "column": 11, + "column": 26, "line": 2, }, }, "range": Array [ - 23, - 24, + 38, + 44, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 33, "line": 2, }, "start": Object { - "column": 12, + "column": 32, "line": 2, }, }, "range": Array [ - 24, - 25, + 44, + 45, ], "type": "Punctuator", "value": ")", @@ -15521,17 +16454,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 35, "line": 2, }, "start": Object { - "column": 14, + "column": 34, "line": 2, }, }, "range": Array [ - 26, - 27, + 46, + 47, ], "type": "Punctuator", "value": "{", @@ -15539,17 +16472,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 15, - "line": 2, + "column": 4, + "line": 4, }, }, "range": Array [ - 27, - 28, + 53, + 54, ], "type": "Punctuator", "value": "}", @@ -15558,16 +16491,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 29, - 30, + 55, + 56, ], "type": "Punctuator", "value": "}", @@ -15577,200 +16510,32 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-generic-method-default.src 1`] = ` +exports[`typescript fixtures/basics/class-with-extends-and-implements.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "getBar", - "range": Array [ - 14, - 20, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 14, - 34, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 32, - 34, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 20, - 34, - ], - "type": "FunctionExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "params": Array [ - Object { - "default": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 25, - 28, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "name": "Bar", - "range": Array [ - 25, - 28, - ], - "type": "Identifier", - }, - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "T", - "range": Array [ - 21, - 22, - ], - "type": "Identifier", - }, - "range": Array [ - 21, - 28, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 20, - 29, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 80, + "line": 1, }, "start": Object { - "column": 10, + "column": 78, "line": 1, }, }, "range": Array [ - 10, - 36, + 78, + 80, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 33, "line": 1, }, "start": Object { @@ -15778,17 +16543,54 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "ClassWithParentAndInterface", "range": Array [ 6, - 9, + 33, ], "type": "Identifier", }, + "implements": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "name": "MyInterface", + "range": Array [ + 66, + 77, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "range": Array [ + 66, + 77, + ], + "type": "TSClassImplements", + }, + ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 80, + "line": 1, }, "start": Object { "column": 0, @@ -15797,16 +16599,33 @@ Object { }, "range": Array [ 0, - 36, + 80, ], - "superClass": null, + "superClass": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "name": "MyOtherClass", + "range": Array [ + 42, + 54, + ], + "type": "Identifier", + }, "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -15815,7 +16634,7 @@ Object { }, "range": Array [ 0, - 37, + 81, ], "sourceType": "script", "tokens": Array [ @@ -15840,7 +16659,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 33, "line": 1, }, "start": Object { @@ -15850,187 +16669,97 @@ Object { }, "range": Array [ 6, - 9, + 33, ], "type": "Identifier", - "value": "Foo", + "value": "ClassWithParentAndInterface", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 41, "line": 1, }, "start": Object { - "column": 10, + "column": 34, "line": 1, }, }, "range": Array [ - 10, - 11, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 14, - 20, - ], - "type": "Identifier", - "value": "getBar", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 20, - 21, + 34, + 41, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 54, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 42, + "line": 1, }, }, "range": Array [ - 21, - 22, + 42, + 54, ], "type": "Identifier", - "value": "T", + "value": "MyOtherClass", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 65, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 55, + "line": 1, }, }, "range": Array [ - 23, - 24, + 55, + 65, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 77, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 66, + "line": 1, }, }, "range": Array [ - 25, - 28, + 66, + 77, ], "type": "Identifier", - "value": "Bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "Punctuator", - "value": ")", + "value": "MyInterface", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 79, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 78, + "line": 1, }, }, "range": Array [ - 32, - 33, + 78, + 79, ], "type": "Punctuator", "value": "{", @@ -16038,35 +16767,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 33, - 34, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + "column": 80, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 79, + "line": 1, }, }, "range": Array [ - 35, - 36, + 79, + 80, ], "type": "Punctuator", "value": "}", @@ -16076,7 +16787,7 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-implements.src 1`] = ` +exports[`typescript fixtures/basics/class-with-extends-generic.src 1`] = ` Object { "body": Array [ Object { @@ -16088,13 +16799,13 @@ Object { "line": 3, }, "start": Object { - "column": 25, + "column": 28, "line": 1, }, }, "range": Array [ - 25, - 29, + 28, + 32, ], "type": "ClassBody", }, @@ -16116,59 +16827,147 @@ Object { ], "type": "Identifier", }, - "implements": Array [ - Object { - "expression": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "superTypeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 24, + "column": 26, "line": 1, }, "start": Object { - "column": 21, + "column": 25, "line": 1, }, }, - "name": "Bar", "range": Array [ - 21, - 24, + 25, + 26, ], - "type": "Identifier", + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, + ], + "range": Array [ + 24, + 27, + ], + "type": "TSTypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, }, - "start": Object { - "column": 21, - "line": 1, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", }, + "range": Array [ + 10, + 11, + ], + "type": "TSTypeParameter", }, - "range": Array [ - 21, - 24, - ], - "type": "TSClassImplements", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TSTypeParameterDeclaration", }, - "range": Array [ - 0, - 29, - ], - "superClass": null, - "type": "ClassDeclaration", }, ], "loc": Object { @@ -16183,7 +16982,7 @@ Object { }, "range": Array [ 0, - 30, + 33, ], "sourceType": "script", "tokens": Array [ @@ -16226,330 +17025,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, "range": Array [ + 9, 10, - 20, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 11, "line": 1, }, "start": Object { - "column": 21, + "column": 10, "line": 1, }, }, "range": Array [ - 21, - 24, + 10, + 11, ], "type": "Identifier", - "value": "Bar", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 12, "line": 1, }, "start": Object { - "column": 25, + "column": 11, "line": 1, }, }, "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 28, - 29, + 11, + 12, ], "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-implements-and-extends.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 80, - "line": 1, - }, - "start": Object { - "column": 78, - "line": 1, - }, - }, - "range": Array [ - 78, - 80, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "ClassWithParentAndInterface", - "range": Array [ - 6, - 33, - ], - "type": "Identifier", - }, - "implements": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 56, - "line": 1, - }, - "start": Object { - "column": 45, - "line": 1, - }, - }, - "name": "MyInterface", - "range": Array [ - 45, - 56, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 56, - "line": 1, - }, - "start": Object { - "column": 45, - "line": 1, - }, - }, - "range": Array [ - 45, - 56, - ], - "type": "TSClassImplements", - }, - ], - "loc": Object { - "end": Object { - "column": 80, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 80, - ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 77, - "line": 1, - }, - "start": Object { - "column": 65, - "line": 1, - }, - }, - "name": "MyOtherClass", - "range": Array [ - 65, - 77, - ], - "type": "Identifier", - }, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "value": ">", }, - }, - "range": Array [ - 0, - 81, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 20, "line": 1, }, "start": Object { - "column": 0, + "column": 13, "line": 1, }, }, "range": Array [ - 0, - 5, + 13, + 20, ], "type": "Keyword", - "value": "class", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 24, "line": 1, }, "start": Object { - "column": 6, + "column": 21, "line": 1, }, }, "range": Array [ - 6, - 33, + 21, + 24, ], "type": "Identifier", - "value": "ClassWithParentAndInterface", + "value": "Bar", }, Object { "loc": Object { "end": Object { - "column": 44, + "column": 25, "line": 1, }, "start": Object { - "column": 34, + "column": 24, "line": 1, }, }, "range": Array [ - 34, - 44, + 24, + 25, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 56, + "column": 26, "line": 1, }, "start": Object { - "column": 45, + "column": 25, "line": 1, }, }, "range": Array [ - 45, - 56, + 25, + 26, ], "type": "Identifier", - "value": "MyInterface", - }, - Object { - "loc": Object { - "end": Object { - "column": 64, - "line": 1, - }, - "start": Object { - "column": 57, - "line": 1, - }, - }, - "range": Array [ - 57, - 64, - ], - "type": "Keyword", - "value": "extends", + "value": "B", }, Object { "loc": Object { "end": Object { - "column": 77, + "column": 27, "line": 1, }, "start": Object { - "column": 65, + "column": 26, "line": 1, }, }, "range": Array [ - 65, - 77, + 26, + 27, ], - "type": "Identifier", - "value": "MyOtherClass", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 79, + "column": 29, "line": 1, }, "start": Object { - "column": 78, + "column": 28, "line": 1, }, }, "range": Array [ - 78, - 79, + 28, + 29, ], "type": "Punctuator", "value": "{", @@ -16557,17 +17187,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 80, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 79, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 79, - 80, + 31, + 32, ], "type": "Punctuator", "value": "}", @@ -16577,7 +17207,7 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-implements-generic.src 1`] = ` +exports[`typescript fixtures/basics/class-with-extends-generic-multiple.src 1`] = ` Object { "body": Array [ Object { @@ -16589,13 +17219,13 @@ Object { "line": 3, }, "start": Object { - "column": 28, + "column": 41, "line": 1, }, }, "range": Array [ - 28, - 32, + 41, + 45, ], "type": "ClassBody", }, @@ -16617,113 +17247,217 @@ Object { ], "type": "Identifier", }, - "implements": Array [ - Object { - "expression": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + }, + "superTypeParameters": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 24, + "column": 36, "line": 1, }, "start": Object { - "column": 21, + "column": 35, "line": 1, }, }, - "name": "Bar", "range": Array [ - 21, - 24, + 35, + 36, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", }, }, - "range": Array [ - 21, - 27, - ], - "type": "TSClassImplements", - "typeParameters": Object { + Object { "loc": Object { "end": Object { - "column": 27, + "column": 39, "line": 1, }, "start": Object { - "column": 24, + "column": 38, "line": 1, }, }, - "params": Array [ - Object { + "range": Array [ + 38, + 39, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "D", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 34, + 40, + ], + "type": "TSTypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": 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": 26, + "column": 21, "line": 1, }, "start": Object { - "column": 25, + "column": 20, "line": 1, }, }, + "name": "B", "range": Array [ - 25, - 26, + 20, + 21, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "S", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", + "type": "Identifier", + }, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, }, }, - ], + "name": "A", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, "range": Array [ - 24, - 27, + 10, + 21, ], - "type": "TSTypeParameterInstantiation", + "type": "TSTypeParameter", }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, + ], + "range": Array [ + 9, + 22, + ], + "type": "TSTypeParameterDeclaration", }, - "range": Array [ - 0, - 32, - ], - "superClass": null, - "type": "ClassDeclaration", }, ], "loc": Object { @@ -16738,7 +17472,7 @@ Object { }, "range": Array [ 0, - 33, + 46, ], "sourceType": "script", "tokens": Array [ @@ -16781,89 +17515,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, "range": Array [ + 9, 10, - 20, ], - "type": "Keyword", - "value": "implements", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 11, "line": 1, }, "start": Object { - "column": 21, + "column": 10, "line": 1, }, }, "range": Array [ - 21, - 24, + 10, + 11, ], "type": "Identifier", - "value": "Bar", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 19, "line": 1, }, "start": Object { - "column": 24, + "column": 12, "line": 1, }, }, "range": Array [ - 24, - 25, + 12, + 19, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 21, "line": 1, }, "start": Object { - "column": 25, + "column": 20, "line": 1, }, }, "range": Array [ - 25, - 26, + 20, + 21, ], "type": "Identifier", - "value": "S", + "value": "B", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 22, "line": 1, }, "start": Object { - "column": 26, + "column": 21, "line": 1, }, }, "range": Array [ - 26, - 27, + 21, + 22, ], "type": "Punctuator", "value": ">", @@ -16871,312 +17605,35 @@ 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": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-implements-generic-multiple.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 35, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "implements": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 30, - ], - "type": "TSClassImplements", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "S", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 28, - 29, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 24, - 30, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 35, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 36, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - "value": "Foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, + "column": 30, "line": 1, }, "start": Object { - "column": 10, + "column": 23, "line": 1, }, }, "range": Array [ - 10, - 20, + 23, + 30, ], "type": "Keyword", - "value": "implements", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 34, "line": 1, }, "start": Object { - "column": 21, + "column": 31, "line": 1, }, }, "range": Array [ - 21, - 24, + 31, + 34, ], "type": "Identifier", "value": "Bar", @@ -17184,17 +17641,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 35, "line": 1, }, "start": Object { - "column": 24, + "column": 34, "line": 1, }, }, "range": Array [ - 24, - 25, + 34, + 35, ], "type": "Punctuator", "value": "<", @@ -17202,35 +17659,35 @@ Object { 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": "Identifier", - "value": "S", + "value": "C", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 37, "line": 1, }, "start": Object { - "column": 26, + "column": 36, "line": 1, }, }, "range": Array [ - 26, - 27, + 36, + 37, ], "type": "Punctuator", "value": ",", @@ -17238,35 +17695,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 39, "line": 1, }, "start": Object { - "column": 28, + "column": 38, "line": 1, }, }, "range": Array [ - 28, - 29, + 38, + 39, ], "type": "Identifier", - "value": "T", + "value": "D", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 40, "line": 1, }, "start": Object { - "column": 29, + "column": 39, "line": 1, }, }, "range": Array [ - 29, - 30, + 39, + 40, ], "type": "Punctuator", "value": ">", @@ -17274,17 +17731,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 42, "line": 1, }, "start": Object { - "column": 31, + "column": 41, "line": 1, }, }, "range": Array [ - 31, - 32, + 41, + 42, ], "type": "Punctuator", "value": "{", @@ -17301,8 +17758,8 @@ Object { }, }, "range": Array [ - 34, - 35, + 44, + 45, ], "type": "Punctuator", "value": "}", @@ -17312,7 +17769,7 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-method.src 1`] = ` +exports[`typescript fixtures/basics/class-with-generic-method.src 1`] = ` Object { "body": Array [ Object { @@ -17323,7 +17780,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 2, }, "start": Object { @@ -17331,17 +17788,17 @@ Object { "line": 2, }, }, - "name": "foo", + "name": "getBar", "range": Array [ - 12, - 15, + 14, + 20, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 19, + "column": 16, "line": 2, }, "start": Object { @@ -17350,8 +17807,8 @@ Object { }, }, "range": Array [ - 12, - 29, + 14, + 28, ], "static": false, "type": "MethodDefinition", @@ -17361,17 +17818,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 19, + "column": 16, "line": 2, }, "start": Object { - "column": 16, + "column": 14, "line": 2, }, }, "range": Array [ 26, - 29, + 28, ], "type": "BlockStatement", }, @@ -17380,90 +17837,406 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 19, + "column": 16, "line": 2, }, "start": Object { - "column": 5, + "column": 8, "line": 2, }, }, "params": Array [], "range": Array [ - 15, - 29, + 20, + 28, ], - "returnType": Object { + "type": "FunctionExpression", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 2, }, "start": Object { - "column": 7, + "column": 8, "line": 2, }, }, - "range": Array [ - 17, - 25, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, }, - "start": Object { - "column": 9, - "line": 2, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeParameter", }, - "range": Array [ - 19, - 25, - ], - "type": "TSNumberKeyword", - }, + ], + "range": Array [ + 20, + 23, + ], + "type": "TSTypeParameterDeclaration", }, - "type": "FunctionExpression", }, }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "name": "bar", - "range": Array [ - 32, - 35, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 30, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "getBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-generic-method-default.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "getBar", + "range": Array [ + 14, + 20, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 22, + "line": 2, }, "start": Object { "column": 2, - "line": 3, + "line": 2, }, }, "range": Array [ - 32, - 44, + 14, + 34, ], "static": false, "type": "MethodDefinition", @@ -17473,17 +18246,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 22, + "line": 2, }, "start": Object { - "column": 11, - "line": 3, + "column": 20, + "line": 2, }, }, "range": Array [ - 41, - 44, + 32, + 34, ], "type": "BlockStatement", }, @@ -17492,175 +18265,132 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 22, + "line": 2, }, "start": Object { - "column": 5, - "line": 3, + "column": 8, + "line": 2, }, }, "params": Array [], "range": Array [ - 35, - 44, + 20, + 34, ], "type": "FunctionExpression", "typeParameters": Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 17, + "line": 2, }, "start": Object { - "column": 5, - "line": 3, + "column": 8, + "line": 2, }, }, "params": Array [ Object { + "default": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "Bar", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + }, "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 16, + "line": 2, }, "start": Object { - "column": 6, - "line": 3, + "column": 9, + "line": 2, }, }, "name": Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 10, + "line": 2, }, "start": Object { - "column": 6, - "line": 3, + "column": 9, + "line": 2, }, }, "name": "T", "range": Array [ - 36, - 37, + 21, + 22, ], "type": "Identifier", }, "range": Array [ - 36, - 37, + 21, + 28, ], "type": "TSTypeParameter", }, ], "range": Array [ - 35, - 38, + 20, + 29, ], "type": "TSTypeParameterDeclaration", }, }, }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "name": "baz", - "range": Array [ - 47, - 50, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 47, - 55, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 53, - 55, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "params": Array [], - "range": Array [ - 50, - 55, - ], - "type": "FunctionExpression", - }, - }, ], "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 57, + 10, + 36, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -17668,17 +18398,17 @@ Object { "line": 1, }, }, - "name": "C", + "name": "Foo", "range": Array [ 6, - 7, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -17687,7 +18417,7 @@ Object { }, "range": Array [ 0, - 57, + 36, ], "superClass": null, "type": "ClassDeclaration", @@ -17696,7 +18426,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -17705,7 +18435,7 @@ Object { }, "range": Array [ 0, - 58, + 37, ], "sourceType": "script", "tokens": Array [ @@ -17730,7 +18460,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -17740,25 +18470,25 @@ Object { }, "range": Array [ 6, - 7, + 9, ], "type": "Identifier", - "value": "C", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 9, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -17766,7 +18496,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 2, }, "start": Object { @@ -17775,83 +18505,83 @@ Object { }, }, "range": Array [ - 12, - 15, + 14, + 20, ], "type": "Identifier", - "value": "foo", + "value": "getBar", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 9, "line": 2, }, "start": Object { - "column": 5, + "column": 8, "line": 2, }, }, "range": Array [ - 15, - 16, + 20, + 21, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 2, }, "start": Object { - "column": 6, + "column": 9, "line": 2, }, }, "range": Array [ - 16, - 17, + 21, + 22, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 2, }, "start": Object { - "column": 7, + "column": 11, "line": 2, }, }, "range": Array [ - 17, - 18, + 23, + 24, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 2, }, "start": Object { - "column": 9, + "column": 13, "line": 2, }, }, "range": Array [ - 19, 25, + 28, ], "type": "Identifier", - "value": "number", + "value": "Bar", }, Object { "loc": Object { @@ -17865,278 +18595,322 @@ Object { }, }, "range": Array [ - 26, - 27, + 28, + 29, ], "type": "Punctuator", - "value": "{", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 18, "line": 2, }, "start": Object { - "column": 18, + "column": 17, "line": 2, }, }, "range": Array [ - 28, 29, + 30, ], "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - "value": "bar", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 19, + "line": 2, }, "start": Object { - "column": 5, - "line": 3, + "column": 18, + "line": 2, }, }, "range": Array [ - 35, - 36, + 30, + 31, ], "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 36, - 37, - ], - "type": "Identifier", - "value": "T", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 21, + "line": 2, }, "start": Object { - "column": 7, - "line": 3, + "column": 20, + "line": 2, }, }, "range": Array [ - 37, - 38, + 32, + 33, ], "type": "Punctuator", - "value": ">", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 22, + "line": 2, }, "start": Object { - "column": 8, - "line": 3, + "column": 21, + "line": 2, }, }, "range": Array [ - 38, - 39, + 33, + 34, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 1, "line": 3, }, "start": Object { - "column": 9, + "column": 0, "line": 3, }, }, "range": Array [ - 39, - 40, + 35, + 36, ], "type": "Punctuator", - "value": ")", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-implements.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 1, + }, }, - "start": Object { - "column": 11, - "line": 3, + "range": Array [ + 25, + 29, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", }, - "range": Array [ - 41, - 42, + "implements": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "TSClassImplements", + }, ], - "type": "Punctuator", - "value": "{", - }, - Object { "loc": Object { "end": Object { - "column": 14, + "column": 1, "line": 3, }, "start": Object { - "column": 13, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 43, - 44, + 0, + 29, ], - "type": "Punctuator", - "value": "}", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { "column": 5, - "line": 4, + "line": 1, }, "start": Object { - "column": 2, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 47, - 50, + 0, + 5, ], - "type": "Identifier", - "value": "baz", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 4, + "column": 9, + "line": 1, }, "start": Object { - "column": 5, - "line": 4, + "column": 6, + "line": 1, }, }, "range": Array [ - 50, - 51, + 6, + 9, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 20, + "line": 1, }, "start": Object { - "column": 6, - "line": 4, + "column": 10, + "line": 1, }, }, "range": Array [ - 51, - 52, + 10, + 20, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 24, + "line": 1, }, "start": Object { - "column": 8, - "line": 4, + "column": 21, + "line": 1, }, }, "range": Array [ - 53, - 54, + 21, + 24, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "Bar", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 26, + "line": 1, }, "start": Object { - "column": 9, - "line": 4, + "column": 25, + "line": 1, }, }, "range": Array [ - 54, - 55, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, - "line": 5, + "line": 3, }, }, "range": Array [ - 56, - 57, + 28, + 29, ], "type": "Punctuator", "value": "}", @@ -18146,875 +18920,122 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-mixin.src 1`] = ` +exports[`typescript fixtures/basics/class-with-implements-and-extends.src 1`] = ` Object { "body": Array [ Object { - "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 79, - 82, - ], - "type": "ClassBody", - }, - "id": null, - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 60, - 82, - ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 25, - "line": 2, - }, - }, - "name": "Base", - "range": Array [ - 74, - 78, - ], - "type": "Identifier", - }, - "type": "ClassExpression", - }, - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 53, - 82, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 80, + "line": 1, }, "start": Object { - "column": 47, + "column": 78, "line": 1, }, }, "range": Array [ - 47, - 84, + 78, + 80, ], - "type": "BlockStatement", + "type": "ClassBody", }, - "expression": false, - "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 33, "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, - "name": "M", + "name": "ClassWithParentAndInterface", "range": Array [ - 9, - 10, + 6, + 33, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ + "implements": Array [ Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "name": "Base", - "range": Array [ - 38, - 45, - ], - "type": "Identifier", - "typeAnnotation": Object { + "expression": Object { "loc": Object { "end": Object { - "column": 45, + "column": 56, "line": 1, }, "start": Object { - "column": 42, + "column": 45, "line": 1, }, }, + "name": "MyInterface", "range": Array [ - 42, 45, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 44, - "line": 1, - }, - }, - "range": Array [ - 44, - 45, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 44, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 44, - 45, - ], - "type": "Identifier", - }, - }, - }, - }, - ], - "range": Array [ - 0, - 84, - ], - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "params": Array [ - Object { - "constraint": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 36, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "Constructor", - "range": Array [ - 21, - 32, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "members": Array [], - "range": Array [ - 33, - 35, - ], - "type": "TSTypeLiteral", - }, - ], - "range": Array [ - 32, - 36, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", - }, - "range": Array [ - 11, - 36, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 10, - 37, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 42, - "line": 5, - }, - "start": Object { - "column": 39, - "line": 5, - }, - }, - "range": Array [ - 125, - 128, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "name": "X", - "range": Array [ - 92, - 93, - ], - "type": "Identifier", - }, - "implements": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 5, - }, - "start": Object { - "column": 37, - "line": 5, - }, - }, - "name": "I", - "range": Array [ - 123, - 124, + 56, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 38, - "line": 5, + "column": 56, + "line": 1, }, "start": Object { - "column": 37, - "line": 5, + "column": 45, + "line": 1, }, }, "range": Array [ - 123, - 124, + 45, + 56, ], "type": "TSClassImplements", }, ], "loc": Object { "end": Object { - "column": 42, - "line": 5, + "column": 80, + "line": 1, }, "start": Object { "column": 0, - "line": 5, + "line": 1, }, }, "range": Array [ - 86, - 128, + 0, + 80, ], "superClass": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 5, - }, - "start": Object { - "column": 23, - "line": 5, - }, - }, - "name": "C", - "range": Array [ - 109, - 110, - ], - "type": "Identifier", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 16, - "line": 5, - }, - }, - "name": "M", - "range": Array [ - 102, - 103, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 5, - }, - "start": Object { - "column": 16, - "line": 5, - }, - }, - "optional": false, - "range": Array [ - 102, - 111, - ], - "type": "CallExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 5, - }, - "start": Object { - "column": 17, - "line": 5, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "range": Array [ - 104, - 107, - ], - "type": "TSAnyKeyword", - }, - ], - "range": Array [ - 103, - 108, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "type": "ClassDeclaration", - }, - Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 11, - "line": 7, - }, - "start": Object { - "column": 8, - "line": 7, - }, - }, - "range": Array [ - 138, - 141, - ], - "type": "ClassBody", - }, - "id": Object { "loc": Object { "end": Object { - "column": 7, - "line": 7, + "column": 77, + "line": 1, }, "start": Object { - "column": 6, - "line": 7, + "column": 65, + "line": 1, }, }, - "name": "C", + "name": "MyOtherClass", "range": Array [ - 136, - 137, + 65, + 77, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 11, - "line": 7, - }, - "start": Object { - "column": 0, - "line": 7, - }, - }, - "range": Array [ - 130, - 141, - ], - "superClass": null, "type": "ClassDeclaration", }, - Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 15, - "line": 8, - }, - "start": Object { - "column": 12, - "line": 8, - }, - }, - "range": Array [ - 154, - 157, - ], - "type": "TSInterfaceBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 8, - }, - "start": Object { - "column": 10, - "line": 8, - }, - }, - "name": "I", - "range": Array [ - 152, - 153, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 8, - }, - "start": Object { - "column": 0, - "line": 8, - }, - }, - "range": Array [ - 142, - 157, - ], - "type": "TSInterfaceDeclaration", - }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 9, - }, - "start": Object { - "column": 5, - "line": 9, - }, - }, - "name": "Constructor", - "range": Array [ - 163, - 174, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 48, - "line": 9, - }, - "start": Object { - "column": 0, - "line": 9, - }, - }, - "range": Array [ - 158, - 206, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 9, - }, - "start": Object { - "column": 22, - "line": 9, - }, - }, - "params": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 9, - }, - "start": Object { - "column": 30, - "line": 9, - }, - }, - "name": "args", - "range": Array [ - 188, - 192, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 41, - "line": 9, - }, - "start": Object { - "column": 27, - "line": 9, - }, - }, - "range": Array [ - 185, - 199, - ], - "type": "RestElement", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 9, - }, - "start": Object { - "column": 34, - "line": 9, - }, - }, - "range": Array [ - 192, - 199, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "elementType": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 9, - }, - "start": Object { - "column": 36, - "line": 9, - }, - }, - "range": Array [ - 194, - 197, - ], - "type": "TSAnyKeyword", - }, - "loc": Object { - "end": Object { - "column": 41, - "line": 9, - }, - "start": Object { - "column": 36, - "line": 9, - }, - }, - "range": Array [ - 194, - 199, - ], - "type": "TSArrayType", - }, - }, - }, - ], - "range": Array [ - 180, - 205, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 9, - }, - "start": Object { - "column": 43, - "line": 9, - }, - }, - "range": Array [ - 201, - 205, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 9, - }, - "start": Object { - "column": 46, - "line": 9, - }, - }, - "range": Array [ - 204, - 205, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 9, - }, - "start": Object { - "column": 46, - "line": 9, - }, - }, - "name": "T", - "range": Array [ - 204, - 205, - ], - "type": "Identifier", - }, - }, - }, - "type": "TSConstructorType", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 9, - }, - "start": Object { - "column": 16, - "line": 9, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 9, - }, - "start": Object { - "column": 17, - "line": 9, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 9, - }, - "start": Object { - "column": 17, - "line": 9, - }, - }, - "name": "T", - "range": Array [ - 175, - 176, - ], - "type": "Identifier", - }, - "range": Array [ - 175, - 176, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 174, - 177, - ], - "type": "TSTypeParameterDeclaration", - }, - }, ], "loc": Object { "end": Object { "column": 0, - "line": 10, + "line": 2, }, "start": Object { "column": 0, @@ -19023,14 +19044,14 @@ Object { }, "range": Array [ 0, - 207, + 81, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 5, "line": 1, }, "start": Object { @@ -19040,79 +19061,79 @@ Object { }, "range": Array [ 0, - 8, + 5, ], "type": "Keyword", - "value": "function", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 33, "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, "range": Array [ - 9, - 10, + 6, + 33, ], "type": "Identifier", - "value": "M", + "value": "ClassWithParentAndInterface", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 44, "line": 1, }, "start": Object { - "column": 10, + "column": 34, "line": 1, }, }, "range": Array [ - 10, - 11, + 34, + 44, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 56, "line": 1, }, "start": Object { - "column": 11, + "column": 45, "line": 1, }, }, "range": Array [ - 11, - 12, + 45, + 56, ], "type": "Identifier", - "value": "T", + "value": "MyInterface", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 64, "line": 1, }, "start": Object { - "column": 13, + "column": 57, "line": 1, }, }, "range": Array [ - 13, - 20, + 57, + 64, ], "type": "Keyword", "value": "extends", @@ -19120,215 +19141,367 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 77, "line": 1, }, "start": Object { - "column": 21, + "column": 65, "line": 1, }, }, "range": Array [ - 21, - 32, + 65, + 77, ], "type": "Identifier", - "value": "Constructor", + "value": "MyOtherClass", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 79, "line": 1, }, "start": Object { - "column": 32, + "column": 78, "line": 1, }, }, "range": Array [ - 32, - 33, + 78, + 79, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 80, "line": 1, }, "start": Object { - "column": 33, + "column": 79, "line": 1, }, }, "range": Array [ - 33, - 34, + 79, + 80, ], "type": "Punctuator", - "value": "{", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-implements-generic.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSClassImplements", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "S", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 34, + "column": 0, "line": 1, }, }, "range": Array [ - 34, - 35, + 0, + 32, ], - "type": "Punctuator", - "value": "}", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 36, + "column": 5, "line": 1, }, "start": Object { - "column": 35, + "column": 0, "line": 1, }, }, "range": Array [ - 35, - 36, + 0, + 5, ], - "type": "Punctuator", - "value": ">", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 9, "line": 1, }, "start": Object { - "column": 36, + "column": 6, "line": 1, }, }, "range": Array [ - 36, - 37, + 6, + 9, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 20, "line": 1, }, "start": Object { - "column": 37, + "column": 10, "line": 1, }, }, "range": Array [ - 37, - 38, + 10, + 20, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 24, "line": 1, }, "start": Object { - "column": 38, + "column": 21, "line": 1, }, }, "range": Array [ - 38, - 42, + 21, + 24, ], "type": "Identifier", - "value": "Base", + "value": "Bar", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 25, "line": 1, }, "start": Object { - "column": 42, + "column": 24, "line": 1, }, }, "range": Array [ - 42, - 43, + 24, + 25, ], "type": "Punctuator", - "value": ":", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 45, + "column": 26, "line": 1, }, "start": Object { - "column": 44, + "column": 25, "line": 1, }, }, "range": Array [ - 44, - 45, + 25, + 26, ], "type": "Identifier", - "value": "T", + "value": "S", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 27, "line": 1, }, "start": Object { - "column": 45, + "column": 26, "line": 1, }, }, "range": Array [ - 45, - 46, + 26, + 27, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 29, "line": 1, }, "start": Object { - "column": 47, + "column": 28, "line": 1, }, }, "range": Array [ - 47, - 48, + 28, + 29, ], "type": "Punctuator", "value": "{", @@ -19336,287 +19509,858 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 4, - "line": 2, + "column": 0, + "line": 3, }, }, "range": Array [ - 53, - 59, + 31, + 32, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-implements-generic-multiple.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 30, + ], + "type": "TSClassImplements", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "S", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 24, + 30, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 11, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 60, - 65, + 0, + 35, ], - "type": "Keyword", - "value": "class", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 66, - 73, + 0, + 5, ], "type": "Keyword", - "value": "extends", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 25, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 74, - 78, + 6, + 9, ], "type": "Identifier", - "value": "Base", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 30, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 79, - 80, + 10, + 20, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 24, + "line": 1, }, "start": Object { - "column": 32, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 81, - 82, + 21, + 24, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "Bar", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 24, + "line": 1, }, }, "range": Array [ - 83, - 84, + 24, + 25, ], "type": "Punctuator", - "value": "}", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 26, + "line": 1, }, "start": Object { - "column": 0, - "line": 5, + "column": 25, + "line": 1, }, }, "range": Array [ - 86, - 91, + 25, + 26, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "S", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 27, + "line": 1, }, "start": Object { - "column": 6, - "line": 5, + "column": 26, + "line": 1, }, }, "range": Array [ - 92, - 93, + 26, + 27, ], - "type": "Identifier", - "value": "X", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 5, + "column": 29, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 28, + "line": 1, }, }, "range": Array [ - 94, - 101, + 28, + 29, ], - "type": "Keyword", - "value": "extends", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 5, + "column": 30, + "line": 1, }, "start": Object { - "column": 16, - "line": 5, + "column": 29, + "line": 1, }, }, "range": Array [ - 102, - 103, + 29, + 30, ], - "type": "Identifier", - "value": "M", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 5, + "column": 32, + "line": 1, }, "start": Object { - "column": 17, - "line": 5, + "column": 31, + "line": 1, }, }, "range": Array [ - 103, - 104, + 31, + 32, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 5, + "column": 1, + "line": 3, }, "start": Object { - "column": 18, - "line": 5, + "column": 0, + "line": 3, }, }, "range": Array [ - 104, - 107, + 34, + 35, ], - "type": "Identifier", - "value": "any", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-method.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 29, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 15, + 29, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 32, + 44, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 35, + 44, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + }, + "range": Array [ + 36, + 37, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 35, + 38, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "baz", + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 47, + 55, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 53, + 55, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 50, + 55, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 57, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 22, + "column": 1, "line": 5, }, "start": Object { - "column": 21, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 107, - 108, + 0, + 57, ], - "type": "Punctuator", - "value": ">", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 23, - "line": 5, + "column": 5, + "line": 1, }, "start": Object { - "column": 22, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 108, - 109, + 0, + 5, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 5, + "column": 7, + "line": 1, }, "start": Object { - "column": 23, - "line": 5, + "column": 6, + "line": 1, }, }, "range": Array [ - 109, - 110, + 6, + 7, ], "type": "Identifier", "value": "C", @@ -19624,503 +20368,341 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 5, + "column": 9, + "line": 1, }, "start": Object { - "column": 24, - "line": 5, + "column": 8, + "line": 1, }, }, "range": Array [ - 110, - 111, + 8, + 9, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 5, + "column": 5, + "line": 2, }, "start": Object { - "column": 26, - "line": 5, + "column": 2, + "line": 2, }, }, "range": Array [ - 112, - 122, + 12, + 15, ], - "type": "Keyword", - "value": "implements", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 5, + "column": 6, + "line": 2, }, "start": Object { - "column": 37, - "line": 5, + "column": 5, + "line": 2, }, }, "range": Array [ - 123, - 124, + 15, + 16, ], - "type": "Identifier", - "value": "I", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 5, + "column": 7, + "line": 2, }, "start": Object { - "column": 39, - "line": 5, + "column": 6, + "line": 2, }, }, "range": Array [ - 125, - 126, + 16, + 17, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 5, + "column": 8, + "line": 2, }, "start": Object { - "column": 41, - "line": 5, + "column": 7, + "line": 2, }, }, "range": Array [ - 127, - 128, + 17, + 18, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 7, + "column": 15, + "line": 2, }, "start": Object { - "column": 0, - "line": 7, + "column": 9, + "line": 2, }, }, "range": Array [ - 130, - 135, + 19, + 25, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 7, + "column": 17, + "line": 2, }, "start": Object { - "column": 6, - "line": 7, + "column": 16, + "line": 2, }, }, "range": Array [ - 136, - 137, + 26, + 27, ], - "type": "Identifier", - "value": "C", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 7, + "column": 19, + "line": 2, }, "start": Object { - "column": 8, - "line": 7, + "column": 18, + "line": 2, }, }, "range": Array [ - 138, - 139, + 28, + 29, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 7, + "column": 5, + "line": 3, }, "start": Object { - "column": 10, - "line": 7, + "column": 2, + "line": 3, }, }, "range": Array [ - 140, - 141, + 32, + 35, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 8, + "column": 6, + "line": 3, }, "start": Object { - "column": 0, - "line": 8, + "column": 5, + "line": 3, }, }, "range": Array [ - 142, - 151, + 35, + 36, ], - "type": "Keyword", - "value": "interface", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 8, + "column": 7, + "line": 3, }, "start": Object { - "column": 10, - "line": 8, + "column": 6, + "line": 3, }, }, "range": Array [ - 152, - 153, + 36, + 37, ], "type": "Identifier", - "value": "I", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 8, + "column": 8, + "line": 3, }, "start": Object { - "column": 12, - "line": 8, + "column": 7, + "line": 3, }, }, "range": Array [ - 154, - 155, + 37, + 38, ], "type": "Punctuator", - "value": "{", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 8, + "column": 9, + "line": 3, }, "start": Object { - "column": 14, - "line": 8, + "column": 8, + "line": 3, }, }, "range": Array [ - 156, - 157, + 38, + 39, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 9, + "column": 10, + "line": 3, }, "start": Object { - "column": 0, - "line": 9, + "column": 9, + "line": 3, }, }, "range": Array [ - 158, - 162, + 39, + 40, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 9, - }, - "start": Object { - "column": 5, - "line": 9, - }, - }, - "range": Array [ - 163, - 174, - ], - "type": "Identifier", - "value": "Constructor", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 9, - }, - "start": Object { - "column": 16, - "line": 9, - }, - }, - "range": Array [ - 174, - 175, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 9, - }, - "start": Object { - "column": 17, - "line": 9, - }, - }, - "range": Array [ - 175, - 176, - ], - "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 9, - }, - "start": Object { - "column": 18, - "line": 9, - }, - }, - "range": Array [ - 176, - 177, - ], - "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 9, - }, - "start": Object { - "column": 20, - "line": 9, - }, - }, - "range": Array [ - 178, - 179, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 9, - }, - "start": Object { - "column": 22, - "line": 9, - }, - }, - "range": Array [ - 180, - 183, - ], - "type": "Keyword", - "value": "new", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 9, - }, - "start": Object { - "column": 26, - "line": 9, - }, - }, - "range": Array [ - 184, - 185, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 9, + "column": 12, + "line": 3, }, "start": Object { - "column": 27, - "line": 9, + "column": 11, + "line": 3, }, }, "range": Array [ - 185, - 188, + 41, + 42, ], "type": "Punctuator", - "value": "...", - }, - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 9, - }, - "start": Object { - "column": 30, - "line": 9, - }, - }, - "range": Array [ - 188, - 192, - ], - "type": "Identifier", - "value": "args", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 9, + "column": 14, + "line": 3, }, "start": Object { - "column": 34, - "line": 9, + "column": 13, + "line": 3, }, }, "range": Array [ - 192, - 193, + 43, + 44, ], "type": "Punctuator", - "value": ":", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 9, + "column": 5, + "line": 4, }, "start": Object { - "column": 36, - "line": 9, + "column": 2, + "line": 4, }, }, "range": Array [ - 194, - 197, + 47, + 50, ], "type": "Identifier", - "value": "any", - }, - Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 9, - }, - "start": Object { - "column": 39, - "line": 9, - }, - }, - "range": Array [ - 197, - 198, - ], - "type": "Punctuator", - "value": "[", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 9, + "column": 6, + "line": 4, }, "start": Object { - "column": 40, - "line": 9, + "column": 5, + "line": 4, }, }, "range": Array [ - 198, - 199, + 50, + 51, ], "type": "Punctuator", - "value": "]", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 9, + "column": 7, + "line": 4, }, "start": Object { - "column": 41, - "line": 9, + "column": 6, + "line": 4, }, }, "range": Array [ - 199, - 200, + 51, + 52, ], "type": "Punctuator", "value": ")", @@ -20128,82 +20710,154 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, - "line": 9, + "column": 9, + "line": 4, }, "start": Object { - "column": 43, - "line": 9, + "column": 8, + "line": 4, }, }, "range": Array [ - 201, - 203, + 53, + 54, ], "type": "Punctuator", - "value": "=>", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 9, + "column": 10, + "line": 4, }, "start": Object { - "column": 46, - "line": 9, + "column": 9, + "line": 4, }, }, "range": Array [ - 204, - 205, + 54, + 55, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 48, - "line": 9, + "column": 1, + "line": 5, }, "start": Object { - "column": 47, - "line": 9, + "column": 0, + "line": 5, }, }, "range": Array [ - 205, - 206, + 56, + 57, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/class-with-mixin-reference.src 1`] = ` +exports[`typescript fixtures/basics/class-with-mixin.src 1`] = ` Object { "body": Array [ Object { "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "argument": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 79, + 82, + ], + "type": "ClassBody", + }, + "id": null, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 60, + 82, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "Base", + "range": Array [ + 74, + 78, + ], + "type": "Identifier", + }, + "type": "ClassExpression", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 53, + 82, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { "column": 1, - "line": 2, + "line": 3, }, "start": Object { - "column": 46, + "column": 47, "line": 1, }, }, "range": Array [ - 46, - 49, + 47, + 84, ], "type": "BlockStatement", }, @@ -20230,7 +20884,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 2, + "line": 3, }, "start": Object { "column": 0, @@ -20241,67 +20895,67 @@ Object { Object { "loc": Object { "end": Object { - "column": 44, + "column": 45, "line": 1, }, "start": Object { - "column": 37, + "column": 38, "line": 1, }, }, "name": "Base", "range": Array [ - 37, - 44, + 38, + 45, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 44, + "column": 45, "line": 1, }, "start": Object { - "column": 41, + "column": 42, "line": 1, }, }, "range": Array [ - 41, - 44, + 42, + 45, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 44, + "column": 45, "line": 1, }, "start": Object { - "column": 43, + "column": 44, "line": 1, }, }, "range": Array [ - 43, 44, + 45, ], "type": "TSTypeReference", "typeName": Object { "loc": Object { "end": Object { - "column": 44, + "column": 45, "line": 1, }, "start": Object { - "column": 43, + "column": 44, "line": 1, }, }, "name": "T", "range": Array [ - 43, 44, + 45, ], "type": "Identifier", }, @@ -20311,13 +20965,13 @@ Object { ], "range": Array [ 0, - 49, + 84, ], "type": "FunctionDeclaration", "typeParameters": Object { "loc": Object { "end": Object { - "column": 36, + "column": 37, "line": 1, }, "start": Object { @@ -20330,7 +20984,7 @@ Object { "constraint": Object { "loc": Object { "end": Object { - "column": 35, + "column": 36, "line": 1, }, "start": Object { @@ -20340,7 +20994,7 @@ Object { }, "range": Array [ 21, - 35, + 36, ], "type": "TSTypeReference", "typeName": Object { @@ -20364,7 +21018,7 @@ Object { "typeParameters": Object { "loc": Object { "end": Object { - "column": 35, + "column": 36, "line": 1, }, "start": Object { @@ -20376,7 +21030,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 35, "line": 1, }, "start": Object { @@ -20384,41 +21038,24 @@ Object { "line": 1, }, }, + "members": Array [], "range": Array [ 33, - 34, + 35, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "name": "M", - "range": Array [ - 33, - 34, - ], - "type": "Identifier", - }, + "type": "TSTypeLiteral", }, ], "range": Array [ 32, - 35, + 36, ], "type": "TSTypeParameterInstantiation", }, }, "loc": Object { "end": Object { - "column": 35, + "column": 36, "line": 1, }, "start": Object { @@ -20446,14 +21083,549 @@ Object { }, "range": Array [ 11, - 35, + 36, ], "type": "TSTypeParameter", }, ], "range": Array [ 10, - 36, + 37, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, + }, + }, + "range": Array [ + 125, + 128, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "X", + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "name": "I", + "range": Array [ + 123, + 124, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "TSClassImplements", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 86, + 128, + ], + "superClass": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "name": "C", + "range": Array [ + 109, + 110, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "name": "M", + "range": Array [ + 102, + 103, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 102, + 111, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "TSAnyKeyword", + }, + ], + "range": Array [ + 103, + 108, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "type": "ClassDeclaration", + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 138, + 141, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "C", + "range": Array [ + 136, + 137, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 130, + 141, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 154, + 157, + ], + "type": "TSInterfaceBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "name": "I", + "range": Array [ + 152, + 153, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 142, + 157, + ], + "type": "TSInterfaceDeclaration", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "name": "Constructor", + "range": Array [ + 163, + 174, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 158, + 206, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 22, + "line": 9, + }, + }, + "params": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 9, + }, + "start": Object { + "column": 30, + "line": 9, + }, + }, + "name": "args", + "range": Array [ + 188, + 192, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 27, + "line": 9, + }, + }, + "range": Array [ + 185, + 199, + ], + "type": "RestElement", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 34, + "line": 9, + }, + }, + "range": Array [ + 192, + 199, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 9, + }, + "start": Object { + "column": 36, + "line": 9, + }, + }, + "range": Array [ + 194, + 197, + ], + "type": "TSAnyKeyword", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 36, + "line": 9, + }, + }, + "range": Array [ + 194, + 199, + ], + "type": "TSArrayType", + }, + }, + }, + ], + "range": Array [ + 180, + 205, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 43, + "line": 9, + }, + }, + "range": Array [ + 201, + 205, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 46, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 46, + "line": 9, + }, + }, + "name": "T", + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + }, + }, + }, + "type": "TSConstructorType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "name": "T", + "range": Array [ + 175, + 176, + ], + "type": "Identifier", + }, + "range": Array [ + 175, + 176, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 174, + 177, ], "type": "TSTypeParameterDeclaration", }, @@ -20462,7 +21634,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 3, + "line": 10, }, "start": Object { "column": 0, @@ -20471,7 +21643,7 @@ Object { }, "range": Array [ 0, - 50, + 207, ], "sourceType": "script", "tokens": Array [ @@ -20616,8 +21788,8 @@ Object { 33, 34, ], - "type": "Identifier", - "value": "M", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { @@ -20635,7 +21807,7 @@ Object { 35, ], "type": "Punctuator", - "value": ">", + "value": "}", }, Object { "loc": Object { @@ -20671,12 +21843,12 @@ Object { 37, ], "type": "Punctuator", - "value": "(", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 38, "line": 1, }, "start": Object { @@ -20686,10 +21858,10 @@ Object { }, "range": Array [ 37, - 41, + 38, ], - "type": "Identifier", - "value": "Base", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -20698,34 +21870,34 @@ Object { "line": 1, }, "start": Object { - "column": 41, + "column": 38, "line": 1, }, }, "range": Array [ - 41, + 38, 42, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "Base", }, Object { "loc": Object { "end": Object { - "column": 44, + "column": 43, "line": 1, }, "start": Object { - "column": 43, + "column": 42, "line": 1, }, }, "range": Array [ + 42, 43, - 44, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { @@ -20742,233 +21914,131 @@ Object { 44, 45, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 47, + "column": 46, "line": 1, }, "start": Object { - "column": 46, + "column": 45, "line": 1, }, }, "range": Array [ + 45, 46, - 47, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 48, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 47, + "line": 1, }, }, "range": Array [ + 47, 48, - 49, ], "type": "Punctuator", - "value": "}", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-optional-computed-property.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": "private", - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 23, - 28, - ], - "raw": "'foo'", - "type": "Literal", - "value": "foo", - }, - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "optional": true, - "range": Array [ - 14, - 43, - ], - "static": false, - "type": "ClassProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "undefined", - "range": Array [ - 33, - 42, - ], - "type": "Identifier", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, }, - "range": Array [ - 8, - 45, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 4, + "line": 2, }, - "name": "X", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", }, + "range": Array [ + 53, + 59, + ], + "type": "Keyword", + "value": "return", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 16, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 0, - 45, + 60, + 65, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "class", }, - }, - "range": Array [ - 0, - 46, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 24, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 0, - 5, + 66, + 73, ], "type": "Keyword", - "value": "class", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 25, + "line": 2, }, }, "range": Array [ - 6, - 7, + 74, + 78, ], "type": "Identifier", - "value": "X", + "value": "Base", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 31, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 30, + "line": 2, }, }, "range": Array [ - 8, - 9, + 79, + 80, ], "type": "Punctuator", "value": "{", @@ -20976,550 +22046,269 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 33, "line": 2, }, "start": Object { - "column": 4, + "column": 32, "line": 2, }, }, "range": Array [ - 14, - 21, + 81, + 82, ], - "type": "Keyword", - "value": "private", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 12, - "line": 2, + "column": 0, + "line": 3, }, }, "range": Array [ - 22, - 23, + 83, + 84, ], "type": "Punctuator", - "value": "[", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 5, + "line": 5, }, "start": Object { - "column": 13, - "line": 2, + "column": 0, + "line": 5, }, }, "range": Array [ - 23, - 28, + 86, + 91, ], - "type": "String", - "value": "'foo'", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 7, + "line": 5, }, "start": Object { - "column": 18, - "line": 2, + "column": 6, + "line": 5, }, }, "range": Array [ - 28, - 29, + 92, + 93, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 15, + "line": 5, }, "start": Object { - "column": 19, - "line": 2, + "column": 8, + "line": 5, }, }, "range": Array [ - 29, - 30, + 94, + 101, ], - "type": "Punctuator", - "value": "?", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 17, + "line": 5, }, "start": Object { - "column": 21, - "line": 2, + "column": 16, + "line": 5, }, }, "range": Array [ - 31, - 32, + 102, + 103, + ], + "type": "Identifier", + "value": "M", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 103, + 104, ], "type": "Punctuator", - "value": "=", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 2, + "column": 21, + "line": 5, }, "start": Object { - "column": 23, - "line": 2, + "column": 18, + "line": 5, }, }, "range": Array [ - 33, - 42, + 104, + 107, ], - "type": "Keyword", - "value": "undefined", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 22, + "line": 5, }, "start": Object { - "column": 32, - "line": 2, + "column": 21, + "line": 5, }, }, "range": Array [ - 42, - 43, + 107, + 108, ], "type": "Punctuator", - "value": ";", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 23, + "line": 5, }, "start": Object { - "column": 0, - "line": 3, + "column": 22, + "line": 5, }, }, "range": Array [ - 44, - 45, + 108, + 109, ], "type": "Punctuator", - "value": "}", + "value": "(", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-optional-methods.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "foo", - "optional": true, - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 14, - 21, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 18, - 21, - ], - "type": "FunctionExpression", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "name": "bar", - "optional": true, - "range": Array [ - 24, - 27, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 24, - 39, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 28, - 39, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 30, - 38, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TSStringKeyword", - }, - }, - "type": "FunctionExpression", - }, - }, - Object { - "accessibility": "private", - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 4, - }, - "start": Object { - "column": 10, - "line": 4, - }, - }, - "name": "baz", - "optional": true, - "range": Array [ - 50, - 53, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 42, - 65, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, - }, - }, - "params": Array [], - "range": Array [ - 54, - 65, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 16, - "line": 4, - }, - }, - "range": Array [ - 56, - 64, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "range": Array [ - 58, - 64, - ], - "type": "TSStringKeyword", - }, - }, - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 24, + "line": 5, }, - "range": Array [ - 10, - 67, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 23, + "line": 5, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, + "range": Array [ + 109, + 110, + ], + "type": "Identifier", + "value": "C", + }, + Object { "loc": Object { "end": Object { - "column": 1, + "column": 25, "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 24, + "line": 5, }, }, "range": Array [ - 0, - 67, + 110, + 111, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ")", }, - }, - "range": Array [ - 0, - 68, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 36, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 26, + "line": 5, }, }, "range": Array [ - 0, - 5, + 112, + 122, ], "type": "Keyword", - "value": "class", + "value": "implements", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 38, + "line": 5, }, "start": Object { - "column": 6, - "line": 1, + "column": 37, + "line": 5, }, }, "range": Array [ - 6, - 9, + 123, + 124, ], "type": "Identifier", - "value": "Foo", + "value": "I", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 40, + "line": 5, }, "start": Object { - "column": 10, - "line": 1, + "column": 39, + "line": 5, }, }, "range": Array [ - 10, - 11, + 125, + 126, ], "type": "Punctuator", "value": "{", @@ -21527,1123 +22316,773 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 42, + "line": 5, }, "start": Object { - "column": 2, - "line": 2, + "column": 41, + "line": 5, }, }, "range": Array [ - 14, - 17, + 127, + 128, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 5, + "line": 7, }, "start": Object { - "column": 5, - "line": 2, + "column": 0, + "line": 7, }, }, "range": Array [ - 17, - 18, + 130, + 135, ], - "type": "Punctuator", - "value": "?", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { "column": 7, - "line": 2, + "line": 7, }, "start": Object { "column": 6, - "line": 2, + "line": 7, }, }, "range": Array [ - 18, - 19, + 136, + 137, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "C", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 9, + "line": 7, }, "start": Object { - "column": 7, - "line": 2, + "column": 8, + "line": 7, }, }, "range": Array [ - 19, - 20, + 138, + 139, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 11, + "line": 7, }, "start": Object { - "column": 8, - "line": 2, + "column": 10, + "line": 7, }, }, "range": Array [ - 20, - 21, + 140, + 141, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 9, + "line": 8, }, "start": Object { - "column": 2, - "line": 3, + "column": 0, + "line": 8, }, }, "range": Array [ - 24, - 27, + 142, + 151, ], - "type": "Identifier", - "value": "bar", + "type": "Keyword", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 11, + "line": 8, }, "start": Object { - "column": 5, - "line": 3, + "column": 10, + "line": 8, }, }, "range": Array [ - 27, - 28, + 152, + 153, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "I", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 13, + "line": 8, }, "start": Object { - "column": 6, - "line": 3, + "column": 12, + "line": 8, }, }, "range": Array [ - 28, - 29, + 154, + 155, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 15, + "line": 8, }, "start": Object { - "column": 7, - "line": 3, + "column": 14, + "line": 8, }, }, "range": Array [ - 29, - 30, + 156, + 157, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 4, + "line": 9, }, "start": Object { - "column": 8, - "line": 3, + "column": 0, + "line": 9, }, }, "range": Array [ - 30, - 31, + 158, + 162, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { "column": 16, - "line": 3, + "line": 9, }, "start": Object { - "column": 10, - "line": 3, + "column": 5, + "line": 9, }, }, "range": Array [ - 32, - 38, + 163, + 174, ], "type": "Identifier", - "value": "string", + "value": "Constructor", }, Object { "loc": Object { "end": Object { "column": 17, - "line": 3, + "line": 9, }, "start": Object { "column": 16, - "line": 3, + "line": 9, }, }, "range": Array [ - 38, - 39, + 174, + 175, ], "type": "Punctuator", - "value": ";", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 18, + "line": 9, }, "start": Object { - "column": 2, - "line": 4, + "column": 17, + "line": 9, }, }, "range": Array [ - 42, - 49, + 175, + 176, ], - "type": "Keyword", - "value": "private", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 19, + "line": 9, }, "start": Object { - "column": 10, - "line": 4, + "column": 18, + "line": 9, }, }, "range": Array [ - 50, - 53, + 176, + 177, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 21, + "line": 9, }, "start": Object { - "column": 13, - "line": 4, + "column": 20, + "line": 9, }, }, "range": Array [ - 53, - 54, + 178, + 179, ], "type": "Punctuator", - "value": "?", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 4, + "column": 25, + "line": 9, }, "start": Object { - "column": 14, - "line": 4, + "column": 22, + "line": 9, }, }, "range": Array [ - 54, - 55, + 180, + 183, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 27, + "line": 9, }, "start": Object { - "column": 15, - "line": 4, + "column": 26, + "line": 9, }, }, "range": Array [ - 55, - 56, + 184, + 185, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 30, + "line": 9, }, "start": Object { - "column": 16, - "line": 4, + "column": 27, + "line": 9, }, }, "range": Array [ - 56, - 57, + 185, + 188, ], "type": "Punctuator", - "value": ":", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 34, + "line": 9, }, "start": Object { - "column": 18, - "line": 4, + "column": 30, + "line": 9, }, }, "range": Array [ - 58, - 64, + 188, + 192, ], "type": "Identifier", - "value": "string", + "value": "args", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 4, + "column": 35, + "line": 9, }, "start": Object { - "column": 24, - "line": 4, + "column": 34, + "line": 9, }, }, "range": Array [ - 64, - 65, + 192, + 193, ], "type": "Punctuator", - "value": ";", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 39, + "line": 9, }, "start": Object { - "column": 0, - "line": 5, + "column": 36, + "line": 9, }, }, "range": Array [ - 66, - 67, + 194, + 197, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "any", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-optional-properties.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "computed", - "range": Array [ - 6, - 14, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 23, - ], - "raw": "'buzz'", - "type": "Literal", - "value": "buzz", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 23, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 40, + "line": 9, + }, + "start": Object { + "column": 39, + "line": 9, }, + }, + "range": Array [ + 197, + 198, ], - "kind": "const", + "type": "Punctuator", + "value": "[", + }, + Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 41, + "line": 9, }, "start": Object { - "column": 0, - "line": 1, + "column": 40, + "line": 9, }, }, "range": Array [ - 0, - 24, + 198, + 199, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": "]", }, Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "name": "computed2", - "range": Array [ - 31, - 40, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 43, - 49, - ], - "raw": "'bazz'", - "type": "Literal", - "value": "bazz", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 31, - 49, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 42, + "line": 9, + }, + "start": Object { + "column": 41, + "line": 9, }, + }, + "range": Array [ + 199, + 200, ], - "kind": "const", + "type": "Punctuator", + "value": ")", + }, + Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 45, + "line": 9, }, "start": Object { - "column": 0, - "line": 2, + "column": 43, + "line": 9, }, }, "range": Array [ - 25, - 50, + 201, + 203, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 46, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 9, + }, + "start": Object { + "column": 47, + "line": 9, + }, + }, + "range": Array [ + 205, + 206, + ], + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-mixin-reference.src 1`] = ` +Object { + "body": Array [ Object { + "async": false, "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "name": "foo", - "range": Array [ - 65, - 68, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "optional": true, - "range": Array [ - 65, - 70, - ], - "static": false, - "type": "ClassProperty", - "value": null, + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "name": "bar", - "range": Array [ - 73, - 76, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 49, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "M", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, }, - "optional": true, - "range": Array [ - 73, - 87, - ], - "static": false, - "type": "ClassProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 5, - }, - "start": Object { - "column": 7, - "line": 5, - }, - }, - "range": Array [ - 78, - 86, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 5, - }, - "start": Object { - "column": 9, - "line": 5, - }, - }, - "range": Array [ - 80, - 86, - ], - "type": "TSStringKeyword", - }, + "start": Object { + "column": 37, + "line": 1, }, - "value": null, }, - Object { - "accessibility": "private", - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 6, - }, - "start": Object { - "column": 10, - "line": 6, - }, - }, - "name": "baz", - "range": Array [ - 98, - 101, - ], - "type": "Identifier", - }, + "name": "Base", + "range": Array [ + 37, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 24, - "line": 6, + "column": 44, + "line": 1, }, "start": Object { - "column": 2, - "line": 6, + "column": 41, + "line": 1, }, }, - "optional": true, "range": Array [ - 90, - 112, + 41, + 44, ], - "static": false, - "type": "ClassProperty", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 23, - "line": 6, + "column": 44, + "line": 1, }, "start": Object { - "column": 15, - "line": 6, + "column": 43, + "line": 1, }, }, "range": Array [ - 103, - 111, + 43, + 44, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 23, - "line": 6, + "column": 44, + "line": 1, }, "start": Object { - "column": 17, - "line": 6, + "column": 43, + "line": 1, }, }, + "name": "T", "range": Array [ - 105, - 111, + 43, + 44, ], - "type": "TSStringKeyword", - }, - }, - "value": null, - }, - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 7, - }, - "start": Object { - "column": 3, - "line": 7, - }, - }, - "name": "computed", - "range": Array [ - 116, - 124, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 7, - }, - "start": Object { - "column": 2, - "line": 7, + "type": "Identifier", }, }, - "optional": true, - "range": Array [ - 115, - 127, - ], - "static": false, - "type": "ClassProperty", - "value": null, }, - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 8, - }, - "start": Object { - "column": 3, - "line": 8, - }, - }, - "range": Array [ - 131, - 140, - ], - "raw": "'literal'", - "type": "Literal", - "value": "literal", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 8, - }, - "start": Object { - "column": 2, - "line": 8, - }, - }, - "optional": true, - "range": Array [ - 130, - 143, - ], - "static": false, - "type": "ClassProperty", - "value": null, + }, + ], + "range": Array [ + 0, + 49, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, }, - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 9, - }, - "start": Object { - "column": 3, - "line": 9, - }, - }, - "range": Array [ - 147, - 148, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 9, - }, - "start": Object { - "column": 2, - "line": 9, - }, - }, - "optional": true, - "range": Array [ - 146, - 151, - ], - "static": false, - "type": "ClassProperty", - "value": null, + "start": Object { + "column": 10, + "line": 1, }, + }, + "params": Array [ Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 10, - }, - "start": Object { - "column": 3, - "line": 10, - }, - }, - "name": "computed2", - "range": Array [ - 155, - 164, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 10, - }, - "start": Object { - "column": 2, - "line": 10, - }, - }, - "optional": true, - "range": Array [ - 154, - 175, - ], - "static": false, - "type": "ClassProperty", - "typeAnnotation": Object { + "constraint": Object { "loc": Object { "end": Object { - "column": 22, - "line": 10, + "column": 35, + "line": 1, }, "start": Object { - "column": 14, - "line": 10, + "column": 21, + "line": 1, }, }, "range": Array [ - 166, - 174, + 21, + 35, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 22, - "line": 10, + "column": 32, + "line": 1, }, "start": Object { - "column": 16, - "line": 10, + "column": 21, + "line": 1, }, }, + "name": "Constructor", "range": Array [ - 168, - 174, + 21, + 32, ], - "type": "TSStringKeyword", - }, - }, - "value": null, - }, - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 11, - }, - "start": Object { - "column": 3, - "line": 11, - }, - }, - "range": Array [ - 179, - 189, - ], - "raw": "'literal2'", - "type": "Literal", - "value": "literal2", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 11, - }, - "start": Object { - "column": 2, - "line": 11, - }, - }, - "optional": true, - "range": Array [ - 178, - 200, - ], - "static": false, - "type": "ClassProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 11, - }, - "start": Object { - "column": 15, - "line": 11, - }, + "type": "Identifier", }, - "range": Array [ - 191, - 199, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "typeParameters": Object { "loc": Object { "end": Object { - "column": 23, - "line": 11, + "column": 35, + "line": 1, }, "start": Object { - "column": 17, - "line": 11, + "column": 32, + "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "name": "M", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + }, + ], "range": Array [ - 193, - 199, + 32, + 35, ], - "type": "TSStringKeyword", - }, - }, - "value": null, - }, - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 12, - }, - "start": Object { - "column": 3, - "line": 12, - }, + "type": "TSTypeParameterInstantiation", }, - "range": Array [ - 204, - 205, - ], - "raw": "2", - "type": "Literal", - "value": 2, }, "loc": Object { "end": Object { - "column": 15, - "line": 12, + "column": 35, + "line": 1, }, "start": Object { - "column": 2, - "line": 12, + "column": 11, + "line": 1, }, }, - "optional": true, - "range": Array [ - 203, - 216, - ], - "static": false, - "type": "ClassProperty", - "typeAnnotation": Object { + "name": Object { "loc": Object { "end": Object { - "column": 14, - "line": 12, + "column": 12, + "line": 1, }, "start": Object { - "column": 6, - "line": 12, + "column": 11, + "line": 1, }, }, + "name": "T", "range": Array [ - 207, - 215, + 11, + 12, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 12, - }, - "start": Object { - "column": 8, - "line": 12, - }, - }, - "range": Array [ - 209, - 215, - ], - "type": "TSStringKeyword", - }, + "type": "Identifier", }, - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 13, - }, - "start": Object { - "column": 10, - "line": 3, + "range": Array [ + 11, + 35, + ], + "type": "TSTypeParameter", }, - }, - "range": Array [ - 61, - 218, ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "name": "Foo", "range": Array [ - 57, - 60, + 10, + 36, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 13, - }, - "start": Object { - "column": 0, - "line": 3, - }, + "type": "TSTypeParameterDeclaration", }, - "range": Array [ - 51, - 218, - ], - "superClass": null, - "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 14, + "line": 3, }, "start": Object { "column": 0, @@ -22652,14 +23091,14 @@ Object { }, "range": Array [ 0, - 219, + 50, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -22669,385 +23108,506 @@ Object { }, "range": Array [ 0, - 5, + 8, ], "type": "Keyword", - "value": "const", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 10, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, "range": Array [ - 6, - 14, + 9, + 10, ], "type": "Identifier", - "value": "computed", + "value": "M", }, 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": "=", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 12, "line": 1, }, "start": Object { - "column": 17, + "column": 11, "line": 1, }, }, "range": Array [ - 17, - 23, + 11, + 12, ], - "type": "String", - "value": "'buzz'", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 20, "line": 1, }, "start": Object { - "column": 23, + "column": 13, "line": 1, }, }, "range": Array [ - 23, - 24, + 13, + 20, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 32, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 25, - 30, + 21, + 32, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "Constructor", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 33, + "line": 1, }, "start": Object { - "column": 6, - "line": 2, + "column": 32, + "line": 1, }, }, "range": Array [ - 31, - 40, + 32, + 33, ], - "type": "Identifier", - "value": "computed2", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 34, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 33, + "line": 1, }, }, "range": Array [ - 41, - 42, + 33, + 34, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "M", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 35, + "line": 1, }, "start": Object { - "column": 18, - "line": 2, + "column": 34, + "line": 1, }, }, "range": Array [ - 43, - 49, + 34, + 35, ], - "type": "String", - "value": "'bazz'", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 36, + "line": 1, }, "start": Object { - "column": 24, - "line": 2, + "column": 35, + "line": 1, }, }, "range": Array [ - 49, - 50, + 35, + 36, ], "type": "Punctuator", - "value": ";", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 37, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 36, + "line": 1, }, }, "range": Array [ - 51, - 56, + 36, + 37, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 41, + "line": 1, }, "start": Object { - "column": 6, - "line": 3, + "column": 37, + "line": 1, }, }, "range": Array [ - 57, - 60, + 37, + 41, ], "type": "Identifier", - "value": "Foo", + "value": "Base", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, + "column": 42, + "line": 1, }, "start": Object { - "column": 10, - "line": 3, + "column": 41, + "line": 1, }, }, "range": Array [ - 61, - 62, + 41, + 42, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 44, + "line": 1, }, "start": Object { - "column": 2, - "line": 4, + "column": 43, + "line": 1, }, }, "range": Array [ - 65, - 68, + 43, + 44, ], "type": "Identifier", - "value": "foo", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 4, + "column": 45, + "line": 1, }, "start": Object { - "column": 5, - "line": 4, + "column": 44, + "line": 1, }, }, "range": Array [ - 68, - 69, + 44, + 45, ], "type": "Punctuator", - "value": "?", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 47, + "line": 1, }, "start": Object { - "column": 6, - "line": 4, + "column": 46, + "line": 1, }, }, "range": Array [ - 69, - 70, + 46, + 47, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 1, + "line": 2, }, "start": Object { - "column": 2, - "line": 5, + "column": 0, + "line": 2, }, }, "range": Array [ - 73, - 76, + 48, + 49, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-optional-computed-property.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": true, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 28, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": true, + "range": Array [ + 14, + 43, + ], + "static": false, + "type": "ClassProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "undefined", + "range": Array [ + 33, + 42, + ], + "type": "Identifier", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 45, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 6, - "line": 5, + "column": 1, + "line": 3, }, "start": Object { - "column": 5, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 76, - 77, + 0, + 45, ], - "type": "Punctuator", - "value": "?", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 46, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, - "line": 5, + "column": 5, + "line": 1, }, "start": Object { - "column": 7, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 78, - 79, + 0, + 5, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 5, + "column": 7, + "line": 1, }, "start": Object { - "column": 9, - "line": 5, + "column": 6, + "line": 1, }, }, "range": Array [ - 80, - 86, + 6, + 7, ], "type": "Identifier", - "value": "string", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 9, + "line": 1, }, "start": Object { - "column": 15, - "line": 5, + "column": 8, + "line": 1, }, }, "range": Array [ - 86, - 87, + 8, + 9, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 6, + "column": 11, + "line": 2, }, "start": Object { - "column": 2, - "line": 6, + "column": 4, + "line": 2, }, }, "range": Array [ - 90, - 97, + 14, + 21, ], "type": "Keyword", "value": "private", @@ -23056,250 +23616,567 @@ Object { "loc": Object { "end": Object { "column": 13, - "line": 6, + "line": 2, }, "start": Object { - "column": 10, - "line": 6, + "column": 12, + "line": 2, }, }, "range": Array [ - 98, - 101, + 22, + 23, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 6, + "column": 18, + "line": 2, }, "start": Object { "column": 13, - "line": 6, + "line": 2, }, }, "range": Array [ - 101, - 102, + 23, + 28, ], - "type": "Punctuator", - "value": "?", + "type": "String", + "value": "'foo'", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 6, + "column": 19, + "line": 2, }, "start": Object { - "column": 15, - "line": 6, + "column": 18, + "line": 2, }, }, "range": Array [ - 103, - 104, + 28, + 29, ], "type": "Punctuator", - "value": ":", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 6, + "column": 20, + "line": 2, }, "start": Object { - "column": 17, - "line": 6, + "column": 19, + "line": 2, }, }, "range": Array [ - 105, - 111, + 29, + 30, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 6, + "column": 22, + "line": 2, }, "start": Object { - "column": 23, - "line": 6, + "column": 21, + "line": 2, }, }, "range": Array [ - 111, - 112, + 31, + 32, ], "type": "Punctuator", - "value": ";", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 7, + "column": 32, + "line": 2, }, "start": Object { - "column": 2, - "line": 7, + "column": 23, + "line": 2, }, }, "range": Array [ - 115, - 116, + 33, + 42, ], - "type": "Punctuator", - "value": "[", + "type": "Keyword", + "value": "undefined", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 7, + "column": 33, + "line": 2, }, "start": Object { - "column": 3, - "line": 7, + "column": 32, + "line": 2, }, }, "range": Array [ - 116, - 124, + 42, + 43, ], - "type": "Identifier", - "value": "computed", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 7, + "column": 1, + "line": 3, }, "start": Object { - "column": 11, - "line": 7, + "column": 0, + "line": 3, }, }, "range": Array [ - 124, - 125, + 44, + 45, ], "type": "Punctuator", - "value": "]", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-optional-methods.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "foo", + "optional": true, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 21, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "bar", + "optional": true, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 24, + 39, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 28, + 39, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": "private", + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "name": "baz", + "optional": true, + "range": Array [ + 50, + 53, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 42, + 65, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 54, + 65, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 56, + 64, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TSStringKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 67, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 13, - "line": 7, + "column": 1, + "line": 5, }, "start": Object { - "column": 12, - "line": 7, + "column": 0, + "line": 1, }, }, "range": Array [ - 125, - 126, + 0, + 67, ], - "type": "Punctuator", - "value": "?", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 68, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 14, - "line": 7, + "column": 5, + "line": 1, }, "start": Object { - "column": 13, - "line": 7, + "column": 0, + "line": 1, }, }, "range": Array [ - 126, - 127, + 0, + 5, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 8, + "column": 9, + "line": 1, }, "start": Object { - "column": 2, - "line": 8, + "column": 6, + "line": 1, }, }, "range": Array [ - 130, - 131, + 6, + 9, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 8, + "column": 11, + "line": 1, }, "start": Object { - "column": 3, - "line": 8, + "column": 10, + "line": 1, }, }, "range": Array [ - 131, - 140, + 10, + 11, ], - "type": "String", - "value": "'literal'", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 8, + "column": 5, + "line": 2, }, "start": Object { - "column": 12, - "line": 8, + "column": 2, + "line": 2, }, }, "range": Array [ - 140, - 141, + 14, + 17, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 8, + "column": 6, + "line": 2, }, "start": Object { - "column": 13, - "line": 8, + "column": 5, + "line": 2, }, }, "range": Array [ - 141, - 142, + 17, + 18, ], "type": "Punctuator", "value": "?", @@ -23307,89 +24184,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 8, + "column": 7, + "line": 2, }, "start": Object { - "column": 14, - "line": 8, + "column": 6, + "line": 2, }, }, "range": Array [ - 142, - 143, + 18, + 19, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 9, + "column": 8, + "line": 2, }, "start": Object { - "column": 2, - "line": 9, + "column": 7, + "line": 2, }, }, "range": Array [ - 146, - 147, + 19, + 20, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 9, + "column": 9, + "line": 2, }, "start": Object { - "column": 3, - "line": 9, + "column": 8, + "line": 2, }, }, "range": Array [ - 147, - 148, + 20, + 21, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 5, - "line": 9, + "line": 3, }, "start": Object { - "column": 4, - "line": 9, + "column": 2, + "line": 3, }, }, "range": Array [ - 148, - 149, + 24, + 27, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { "column": 6, - "line": 9, + "line": 3, }, "start": Object { "column": 5, - "line": 9, + "line": 3, }, }, "range": Array [ - 149, - 150, + 27, + 28, ], "type": "Punctuator", "value": "?", @@ -23398,232 +24275,196 @@ Object { "loc": Object { "end": Object { "column": 7, - "line": 9, + "line": 3, }, "start": Object { "column": 6, - "line": 9, + "line": 3, }, }, "range": Array [ - 150, - 151, + 28, + 29, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 10, + "column": 8, + "line": 3, }, "start": Object { - "column": 2, - "line": 10, + "column": 7, + "line": 3, }, }, "range": Array [ - 154, - 155, + 29, + 30, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 10, + "column": 9, + "line": 3, }, "start": Object { - "column": 3, - "line": 10, + "column": 8, + "line": 3, }, }, "range": Array [ - 155, - 164, + 30, + 31, ], - "type": "Identifier", - "value": "computed2", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 10, + "column": 16, + "line": 3, }, "start": Object { - "column": 12, - "line": 10, + "column": 10, + "line": 3, }, }, "range": Array [ - 164, - 165, + 32, + 38, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 10, + "column": 17, + "line": 3, }, "start": Object { - "column": 13, - "line": 10, + "column": 16, + "line": 3, }, }, "range": Array [ - 165, - 166, + 38, + 39, ], "type": "Punctuator", - "value": "?", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 10, + "column": 9, + "line": 4, }, "start": Object { - "column": 14, - "line": 10, + "column": 2, + "line": 4, }, }, "range": Array [ - 166, - 167, + 42, + 49, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "private", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 10, + "column": 13, + "line": 4, }, "start": Object { - "column": 16, - "line": 10, + "column": 10, + "line": 4, }, }, "range": Array [ - 168, - 174, + 50, + 53, ], "type": "Identifier", - "value": "string", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 10, + "column": 14, + "line": 4, }, "start": Object { - "column": 22, - "line": 10, + "column": 13, + "line": 4, }, }, "range": Array [ - 174, - 175, + 53, + 54, ], "type": "Punctuator", - "value": ";", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 11, + "column": 15, + "line": 4, }, "start": Object { - "column": 2, - "line": 11, - }, - }, - "range": Array [ - 178, - 179, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 11, - }, - "start": Object { - "column": 3, - "line": 11, - }, - }, - "range": Array [ - 179, - 189, - ], - "type": "String", - "value": "'literal2'", - }, - Object { - "loc": Object { - "end": Object { "column": 14, - "line": 11, - }, - "start": Object { - "column": 13, - "line": 11, + "line": 4, }, }, "range": Array [ - 189, - 190, + 54, + 55, ], "type": "Punctuator", - "value": "]", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 11, + "column": 16, + "line": 4, }, "start": Object { - "column": 14, - "line": 11, + "column": 15, + "line": 4, }, }, "range": Array [ - 190, - 191, + 55, + 56, ], "type": "Punctuator", - "value": "?", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 11, + "column": 17, + "line": 4, }, "start": Object { - "column": 15, - "line": 11, + "column": 16, + "line": 4, }, }, "range": Array [ - 191, - 192, + 56, + 57, ], "type": "Punctuator", "value": ":", @@ -23631,17 +24472,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 11, + "column": 24, + "line": 4, }, "start": Object { - "column": 17, - "line": 11, + "column": 18, + "line": 4, }, }, "range": Array [ - 193, - 199, + 58, + 64, ], "type": "Identifier", "value": "string", @@ -23649,17 +24490,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, - "line": 11, + "column": 25, + "line": 4, }, "start": Object { - "column": 23, - "line": 11, + "column": 24, + "line": 4, }, }, "range": Array [ - 199, - 200, + 64, + 65, ], "type": "Punctuator", "value": ";", @@ -23667,263 +24508,763 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 12, - }, - "start": Object { - "column": 2, - "line": 12, - }, - }, - "range": Array [ - 203, - 204, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 12, - }, - "start": Object { - "column": 3, - "line": 12, - }, - }, - "range": Array [ - 204, - 205, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 12, - }, - "start": Object { - "column": 4, - "line": 12, - }, - }, - "range": Array [ - 205, - 206, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 12, + "column": 1, + "line": 5, }, "start": Object { - "column": 5, - "line": 12, + "column": 0, + "line": 5, }, }, "range": Array [ - 206, - 207, + 66, + 67, ], "type": "Punctuator", - "value": "?", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-optional-properties.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 12, - }, - "start": Object { - "column": 6, - "line": 12, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "computed", + "range": Array [ + 6, + 14, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "raw": "'buzz'", + "type": "Literal", + "value": "buzz", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 23, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 207, - 208, ], - "type": "Punctuator", - "value": ":", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 14, - "line": 12, + "column": 24, + "line": 1, }, "start": Object { - "column": 8, - "line": 12, + "column": 0, + "line": 1, }, }, "range": Array [ - 209, - 215, + 0, + 24, ], - "type": "Identifier", - "value": "string", + "type": "VariableDeclaration", }, Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 12, - }, - "start": Object { - "column": 14, - "line": 12, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "computed2", + "range": Array [ + 31, + 40, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 43, + 49, + ], + "raw": "'bazz'", + "type": "Literal", + "value": "bazz", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 31, + 49, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 215, - 216, ], - "type": "Punctuator", - "value": ";", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 1, - "line": 13, + "column": 25, + "line": 2, }, "start": Object { "column": 0, - "line": 13, + "line": 2, }, }, "range": Array [ - 217, - 218, + 25, + 50, ], - "type": "Punctuator", - "value": "}", + "type": "VariableDeclaration", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-optional-property-undefined.src 1`] = ` -Object { - "body": Array [ Object { "body": Object { "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "foo", + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": true, + "range": Array [ + 65, + 70, + ], + "static": false, + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "bar", + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": true, + "range": Array [ + 73, + 87, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 78, + 86, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 80, + 86, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, Object { "accessibility": "private", "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { "column": 13, - "line": 2, + "line": 6, }, "start": Object { "column": 10, - "line": 2, + "line": 6, }, }, - "name": "foo", + "name": "baz", "range": Array [ - 20, - 23, + 98, + 101, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 24, + "line": 6, }, "start": Object { "column": 2, - "line": 2, + "line": 6, }, }, "optional": true, "range": Array [ - 12, - 37, + 90, + 112, ], "static": false, "type": "ClassProperty", - "value": Object { + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 23, + "line": 6, }, "start": Object { - "column": 17, - "line": 2, + "column": 15, + "line": 6, }, }, - "name": "undefined", "range": Array [ - 27, - 36, + 103, + 111, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 105, + 111, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "computed": true, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "name": "computed", + "range": Array [ + 116, + 124, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "optional": true, + "range": Array [ + 115, + 127, + ], + "static": false, + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": true, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "range": Array [ + 131, + 140, + ], + "raw": "'literal'", + "type": "Literal", + "value": "literal", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "optional": true, + "range": Array [ + 130, + 143, + ], + "static": false, + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": true, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 147, + 148, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": true, + "range": Array [ + 146, + 151, + ], + "static": false, + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": true, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "name": "computed2", + "range": Array [ + 155, + 164, ], "type": "Identifier", }, + "loc": Object { + "end": Object { + "column": 23, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 154, + 175, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "range": Array [ + 166, + 174, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 10, + }, + "start": Object { + "column": 16, + "line": 10, + }, + }, + "range": Array [ + 168, + 174, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "computed": true, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "start": Object { + "column": 3, + "line": 11, + }, + }, + "range": Array [ + 179, + 189, + ], + "raw": "'literal2'", + "type": "Literal", + "value": "literal2", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "optional": true, + "range": Array [ + 178, + 200, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 191, + 199, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "range": Array [ + 193, + 199, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "computed": true, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "range": Array [ + 204, + 205, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "optional": true, + "range": Array [ + 203, + 216, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 6, + "line": 12, + }, + }, + "range": Array [ + 207, + 215, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 209, + 215, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 13, }, "start": Object { - "column": 8, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 8, - 39, + 61, + 218, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 9, + "line": 3, }, "start": Object { "column": 6, - "line": 1, + "line": 3, }, }, - "name": "X", + "name": "Foo", "range": Array [ - 6, - 7, + 57, + 60, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 13, }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 39, + 51, + 218, ], "superClass": null, "type": "ClassDeclaration", @@ -23932,7 +25273,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 14, }, "start": Object { "column": 0, @@ -23941,7 +25282,7 @@ Object { }, "range": Array [ 0, - 41, + 219, ], "sourceType": "script", "tokens": Array [ @@ -23961,12 +25302,12 @@ Object { 5, ], "type": "Keyword", - "value": "class", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 14, "line": 1, }, "start": Object { @@ -23976,97 +25317,115 @@ Object { }, "range": Array [ 6, - 7, + 14, ], "type": "Identifier", - "value": "X", + "value": "computed", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 1, }, "start": Object { - "column": 8, + "column": 15, "line": 1, }, }, "range": Array [ - 8, - 9, + 15, + 16, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 17, + "line": 1, }, }, "range": Array [ - 12, - 19, + 17, + 23, ], - "type": "Keyword", - "value": "private", + "type": "String", + "value": "'buzz'", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, "line": 2, }, "start": Object { - "column": 10, + "column": 0, "line": 2, }, }, "range": Array [ - 20, - 23, + 25, + 30, ], - "type": "Identifier", - "value": "foo", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 2, }, "start": Object { - "column": 13, + "column": 6, "line": 2, }, }, "range": Array [ - 23, - 24, + 31, + 40, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "computed2", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 2, }, "start": Object { - "column": 15, + "column": 16, "line": 2, }, }, "range": Array [ - 25, - 26, + 41, + 42, ], "type": "Punctuator", "value": "=", @@ -24074,35 +25433,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 24, "line": 2, }, "start": Object { - "column": 17, + "column": 18, "line": 2, }, }, "range": Array [ - 27, - 36, + 43, + 49, ], - "type": "Keyword", - "value": "undefined", + "type": "String", + "value": "'bazz'", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 25, "line": 2, }, "start": Object { - "column": 26, + "column": 24, "line": 2, }, }, "range": Array [ - 36, - 37, + 49, + 50, ], "type": "Punctuator", "value": ";", @@ -24110,7 +25469,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 3, }, "start": Object { @@ -24119,1595 +25478,782 @@ Object { }, }, "range": Array [ - 38, - 39, + 51, + 56, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "class", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-private-parameter-properties.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "constructor", - "range": Array [ - 14, - 25, - ], - "type": "Identifier", - }, - "kind": "constructor", - "loc": Object { - "end": Object { - "column": 59, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 14, - 201, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 59, - "line": 5, - }, - "start": Object { - "column": 57, - "line": 5, - }, - }, - "range": Array [ - 199, - 201, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 59, - "line": 5, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "params": Array [ - Object { - "accessibility": "private", - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "name": "firstName", - "range": Array [ - 34, - 51, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 31, - "line": 2, - }, - }, - "range": Array [ - 43, - 51, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 33, - "line": 2, - }, - }, - "range": Array [ - 45, - 51, - ], - "type": "TSStringKeyword", - }, - }, - }, - "range": Array [ - 26, - 51, - ], - "type": "TSParameterProperty", - }, - Object { - "accessibility": "private", - "loc": Object { - "end": Object { - "column": 47, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 3, - }, - "start": Object { - "column": 31, - "line": 3, - }, - }, - "name": "lastName", - "range": Array [ - 84, - 100, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 3, - }, - "start": Object { - "column": 39, - "line": 3, - }, - }, - "range": Array [ - 92, - 100, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 3, - }, - "start": Object { - "column": 41, - "line": 3, - }, - }, - "range": Array [ - 94, - 100, - ], - "type": "TSStringKeyword", - }, - }, - }, - "range": Array [ - 67, - 100, - ], - "readonly": true, - "type": "TSParameterProperty", - }, - Object { - "accessibility": "private", - "loc": Object { - "end": Object { - "column": 38, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, - }, - }, - "parameter": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 4, - }, - "start": Object { - "column": 22, - "line": 4, - }, - }, - "name": "age", - "range": Array [ - 124, - 135, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 4, - }, - "start": Object { - "column": 25, - "line": 4, - }, - }, - "range": Array [ - 127, - 135, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 4, - }, - "start": Object { - "column": 27, - "line": 4, - }, - }, - "range": Array [ - 129, - 135, - ], - "type": "TSNumberKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 38, - "line": 4, - }, - "start": Object { - "column": 22, - "line": 4, - }, - }, - "range": Array [ - 124, - 140, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 4, - }, - "start": Object { - "column": 36, - "line": 4, - }, - }, - "range": Array [ - 138, - 140, - ], - "raw": "30", - "type": "Literal", - "value": 30, - }, - "type": "AssignmentPattern", - }, - "range": Array [ - 116, - 140, - ], - "type": "TSParameterProperty", - }, - Object { - "accessibility": "private", - "loc": Object { - "end": Object { - "column": 55, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "parameter": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 5, - }, - "start": Object { - "column": 31, - "line": 5, - }, - }, - "name": "student", - "range": Array [ - 173, - 189, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 5, - }, - "start": Object { - "column": 38, - "line": 5, - }, - }, - "range": Array [ - 180, - 189, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 5, - }, - "start": Object { - "column": 40, - "line": 5, - }, - }, - "range": Array [ - 182, - 189, - ], - "type": "TSBooleanKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 55, - "line": 5, - }, - "start": Object { - "column": 31, - "line": 5, - }, - }, - "range": Array [ - 173, - 197, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 55, - "line": 5, - }, - "start": Object { - "column": 50, - "line": 5, - }, - }, - "range": Array [ - 192, - 197, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, - "type": "AssignmentPattern", - }, - "range": Array [ - 156, - 197, - ], - "readonly": true, - "type": "TSParameterProperty", - }, - ], - "range": Array [ - 25, - 201, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, }, - "range": Array [ - 10, - 203, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 6, + "line": 3, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 11, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 0, - 203, + 61, + 62, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 203, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { "column": 5, - "line": 1, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 0, - 5, + 65, + 68, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 6, + "line": 4, }, "start": Object { - "column": 6, - "line": 1, + "column": 5, + "line": 4, }, }, "range": Array [ - 6, - 9, + 68, + 69, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 7, + "line": 4, }, "start": Object { - "column": 10, - "line": 1, + "column": 6, + "line": 4, }, }, "range": Array [ - 10, - 11, + 69, + 70, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 5, + "line": 5, }, "start": Object { "column": 2, - "line": 2, + "line": 5, }, }, "range": Array [ - 14, - 25, + 73, + 76, ], "type": "Identifier", - "value": "constructor", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 6, + "line": 5, }, "start": Object { - "column": 13, - "line": 2, + "column": 5, + "line": 5, }, }, "range": Array [ - 25, - 26, + 76, + 77, ], "type": "Punctuator", - "value": "(", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 8, + "line": 5, }, "start": Object { - "column": 14, - "line": 2, + "column": 7, + "line": 5, }, }, "range": Array [ - 26, - 33, + 78, + 79, ], - "type": "Keyword", - "value": "private", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 2, + "column": 15, + "line": 5, }, "start": Object { - "column": 22, - "line": 2, + "column": 9, + "line": 5, }, }, "range": Array [ - 34, - 43, + 80, + 86, ], "type": "Identifier", - "value": "firstName", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 2, + "column": 16, + "line": 5, }, "start": Object { - "column": 31, - "line": 2, + "column": 15, + "line": 5, }, }, "range": Array [ - 43, - 44, + 86, + 87, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 2, + "column": 9, + "line": 6, }, "start": Object { - "column": 33, - "line": 2, + "column": 2, + "line": 6, }, }, "range": Array [ - 45, - 51, + 90, + 97, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 98, + 101, ], "type": "Identifier", - "value": "string", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 2, + "column": 14, + "line": 6, }, "start": Object { - "column": 39, - "line": 2, + "column": 13, + "line": 6, }, }, "range": Array [ - 51, - 52, + 101, + 102, ], "type": "Punctuator", - "value": ",", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 3, + "column": 16, + "line": 6, }, "start": Object { - "column": 14, - "line": 3, + "column": 15, + "line": 6, }, }, "range": Array [ - 67, - 74, + 103, + 104, ], - "type": "Keyword", - "value": "private", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 3, + "column": 23, + "line": 6, }, "start": Object { - "column": 22, - "line": 3, + "column": 17, + "line": 6, }, }, "range": Array [ - 75, - 83, + 105, + 111, ], "type": "Identifier", - "value": "readonly", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 3, + "column": 24, + "line": 6, }, "start": Object { - "column": 31, - "line": 3, + "column": 23, + "line": 6, }, }, "range": Array [ - 84, - 92, + 111, + 112, ], - "type": "Identifier", - "value": "lastName", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 3, + "column": 3, + "line": 7, }, "start": Object { - "column": 39, - "line": 3, + "column": 2, + "line": 7, }, }, "range": Array [ - 92, - 93, + 115, + 116, ], "type": "Punctuator", - "value": ":", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 3, + "column": 11, + "line": 7, }, "start": Object { - "column": 41, - "line": 3, + "column": 3, + "line": 7, }, }, "range": Array [ - 94, - 100, + 116, + 124, ], "type": "Identifier", - "value": "string", + "value": "computed", }, Object { "loc": Object { "end": Object { - "column": 48, - "line": 3, + "column": 12, + "line": 7, }, "start": Object { - "column": 47, - "line": 3, + "column": 11, + "line": 7, }, }, "range": Array [ - 100, - 101, + 124, + 125, ], "type": "Punctuator", - "value": ",", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 4, + "column": 13, + "line": 7, }, "start": Object { - "column": 14, - "line": 4, + "column": 12, + "line": 7, }, }, "range": Array [ - 116, - 123, + 125, + 126, ], - "type": "Keyword", - "value": "private", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 4, + "column": 14, + "line": 7, }, "start": Object { - "column": 22, - "line": 4, + "column": 13, + "line": 7, }, }, "range": Array [ - 124, + 126, 127, ], - "type": "Identifier", - "value": "age", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 3, + "line": 8, }, "start": Object { - "column": 25, - "line": 4, + "column": 2, + "line": 8, }, }, "range": Array [ - 127, - 128, + 130, + 131, ], "type": "Punctuator", - "value": ":", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 4, + "column": 12, + "line": 8, }, "start": Object { - "column": 27, - "line": 4, + "column": 3, + "line": 8, }, }, "range": Array [ - 129, - 135, + 131, + 140, ], - "type": "Identifier", - "value": "number", + "type": "String", + "value": "'literal'", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 4, + "column": 13, + "line": 8, }, "start": Object { - "column": 34, - "line": 4, + "column": 12, + "line": 8, }, }, "range": Array [ - 136, - 137, + 140, + 141, ], "type": "Punctuator", - "value": "=", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 4, + "column": 14, + "line": 8, }, "start": Object { - "column": 36, - "line": 4, + "column": 13, + "line": 8, }, }, "range": Array [ - 138, - 140, + 141, + 142, ], - "type": "Numeric", - "value": "30", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 4, + "column": 15, + "line": 8, }, "start": Object { - "column": 38, - "line": 4, + "column": 14, + "line": 8, }, }, "range": Array [ - 140, - 141, + 142, + 143, ], "type": "Punctuator", - "value": ",", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 5, + "column": 3, + "line": 9, }, "start": Object { - "column": 14, - "line": 5, + "column": 2, + "line": 9, }, }, "range": Array [ - 156, - 163, + 146, + 147, ], - "type": "Keyword", - "value": "private", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 5, + "column": 4, + "line": 9, }, "start": Object { - "column": 22, - "line": 5, + "column": 3, + "line": 9, }, }, "range": Array [ - 164, - 172, + 147, + 148, ], - "type": "Identifier", - "value": "readonly", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 5, + "column": 5, + "line": 9, }, "start": Object { - "column": 31, - "line": 5, + "column": 4, + "line": 9, }, }, "range": Array [ - 173, - 180, + 148, + 149, ], - "type": "Identifier", - "value": "student", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 5, + "column": 6, + "line": 9, }, "start": Object { - "column": 38, - "line": 5, + "column": 5, + "line": 9, }, }, "range": Array [ - 180, - 181, + 149, + 150, ], "type": "Punctuator", - "value": ":", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 5, + "column": 7, + "line": 9, }, "start": Object { - "column": 40, - "line": 5, + "column": 6, + "line": 9, }, }, "range": Array [ - 182, - 189, + 150, + 151, ], - "type": "Identifier", - "value": "boolean", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 49, - "line": 5, + "column": 3, + "line": 10, }, "start": Object { - "column": 48, - "line": 5, + "column": 2, + "line": 10, }, }, "range": Array [ - 190, - 191, + 154, + 155, ], "type": "Punctuator", - "value": "=", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 55, - "line": 5, + "column": 12, + "line": 10, }, "start": Object { - "column": 50, - "line": 5, + "column": 3, + "line": 10, }, }, "range": Array [ - 192, - 197, + 155, + 164, ], - "type": "Boolean", - "value": "false", + "type": "Identifier", + "value": "computed2", }, Object { "loc": Object { "end": Object { - "column": 56, - "line": 5, + "column": 13, + "line": 10, }, "start": Object { - "column": 55, - "line": 5, + "column": 12, + "line": 10, }, }, "range": Array [ - 197, - 198, + 164, + 165, ], "type": "Punctuator", - "value": ")", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 58, - "line": 5, + "column": 14, + "line": 10, }, "start": Object { - "column": 57, - "line": 5, + "column": 13, + "line": 10, }, }, "range": Array [ - 199, - 200, + 165, + 166, ], "type": "Punctuator", - "value": "{", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 59, - "line": 5, + "column": 15, + "line": 10, }, "start": Object { - "column": 58, - "line": 5, + "column": 14, + "line": 10, }, }, "range": Array [ - 200, - 201, + 166, + 167, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 22, + "line": 10, }, "start": Object { - "column": 0, - "line": 6, + "column": 16, + "line": 10, }, }, "range": Array [ - 202, - 203, + 168, + 174, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "string", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-property-function.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 43, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 14, - 55, - ], - "static": false, - "type": "ClassProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 17, - 32, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 19, - 32, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 22, - 32, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 25, - 32, - ], - "type": "TSBooleanKeyword", - }, - }, - "type": "TSFunctionType", - }, - }, - "value": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 2, - }, - "start": Object { - "column": 38, - "line": 2, - }, - }, - "range": Array [ - 50, - 54, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 42, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 35, - 54, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 2, - }, - "start": Object { - "column": 25, - "line": 2, - }, - }, - "range": Array [ - 37, - 46, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "range": Array [ - 39, - 46, - ], - "type": "TSBooleanKeyword", - }, - }, - "type": "ArrowFunctionExpression", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "name": "bar", - "range": Array [ - 58, - 61, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 58, - 83, - ], - "static": false, - "type": "ClassProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 61, - 69, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "range": Array [ - 63, - 69, - ], - "type": "TSStringKeyword", - }, - }, - "value": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 3, - }, - "start": Object { - "column": 22, - "line": 3, - }, - }, - "name": "test", - "range": Array [ - 78, - 82, - ], - "type": "Identifier", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 26, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 72, - 82, - ], - "type": "ArrowFunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 85, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 23, + "line": 10, }, "start": Object { - "column": 0, - "line": 1, + "column": 22, + "line": 10, }, }, "range": Array [ - 0, - 85, + 174, + 175, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ";", }, - }, - "range": Array [ - 0, - 86, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 3, + "line": 11, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 11, }, }, "range": Array [ - 0, - 5, + 178, + 179, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 13, + "line": 11, }, "start": Object { - "column": 6, - "line": 1, + "column": 3, + "line": 11, }, }, "range": Array [ - 6, - 9, + 179, + 189, ], - "type": "Identifier", - "value": "Foo", + "type": "String", + "value": "'literal2'", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 14, + "line": 11, }, "start": Object { - "column": 10, - "line": 1, + "column": 13, + "line": 11, }, }, "range": Array [ - 10, - 11, + 189, + 190, ], "type": "Punctuator", - "value": "{", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 15, + "line": 11, }, "start": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 11, }, }, "range": Array [ - 14, - 17, + 190, + 191, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 16, + "line": 11, }, "start": Object { - "column": 5, - "line": 2, + "column": 15, + "line": 11, }, }, "range": Array [ - 17, - 18, + 191, + 192, ], "type": "Punctuator", "value": ":", @@ -25715,377 +26261,479 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 23, + "line": 11, }, "start": Object { - "column": 7, - "line": 2, + "column": 17, + "line": 11, }, }, "range": Array [ - 19, - 20, + 193, + 199, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 24, + "line": 11, }, "start": Object { - "column": 8, - "line": 2, + "column": 23, + "line": 11, }, }, "range": Array [ - 20, - 21, + 199, + 200, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 3, + "line": 12, }, "start": Object { - "column": 10, - "line": 2, + "column": 2, + "line": 12, }, }, "range": Array [ - 22, - 24, + 203, + 204, ], "type": "Punctuator", - "value": "=>", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 4, + "line": 12, }, "start": Object { - "column": 13, - "line": 2, + "column": 3, + "line": 12, }, }, "range": Array [ - 25, - 32, + 204, + 205, ], - "type": "Identifier", - "value": "boolean", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 5, + "line": 12, }, "start": Object { - "column": 21, - "line": 2, + "column": 4, + "line": 12, }, }, "range": Array [ - 33, - 34, + 205, + 206, ], "type": "Punctuator", - "value": "=", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 6, + "line": 12, }, "start": Object { - "column": 23, - "line": 2, + "column": 5, + "line": 12, }, }, "range": Array [ - 35, - 36, + 206, + 207, ], "type": "Punctuator", - "value": "(", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 7, + "line": 12, }, "start": Object { - "column": 24, - "line": 2, + "column": 6, + "line": 12, }, }, "range": Array [ - 36, - 37, + 207, + 208, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 14, + "line": 12, }, "start": Object { - "column": 25, - "line": 2, + "column": 8, + "line": 12, }, }, "range": Array [ - 37, - 38, + 209, + 215, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 15, + "line": 12, }, "start": Object { - "column": 27, - "line": 2, + "column": 14, + "line": 12, }, }, "range": Array [ - 39, - 46, + 215, + 216, ], - "type": "Identifier", - "value": "boolean", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 1, + "line": 13, }, "start": Object { - "column": 35, - "line": 2, + "column": 0, + "line": 13, }, }, "range": Array [ - 47, - 49, + 217, + 218, ], "type": "Punctuator", - "value": "=>", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-optional-property-undefined.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 2, + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": true, + "range": Array [ + 12, + 37, + ], + "static": false, + "type": "ClassProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "undefined", + "range": Array [ + 27, + 36, + ], + "type": "Identifier", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, - "start": Object { - "column": 38, - "line": 2, + "range": Array [ + 8, + 39, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "name": "X", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", }, - "range": Array [ - 50, - 54, - ], - "type": "Boolean", - "value": "true", - }, - Object { "loc": Object { "end": Object { - "column": 43, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { - "column": 42, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 54, - 55, + 0, + 39, ], - "type": "Punctuator", - "value": ";", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { "column": 5, - "line": 3, + "line": 1, }, "start": Object { - "column": 2, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 58, - 61, + 0, + 5, ], - "type": "Identifier", - "value": "bar", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 7, + "line": 1, }, "start": Object { - "column": 5, - "line": 3, + "column": 6, + "line": 1, }, }, "range": Array [ - 61, - 62, + 6, + 7, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "X", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 9, + "line": 1, }, "start": Object { - "column": 7, - "line": 3, + "column": 8, + "line": 1, }, }, "range": Array [ - 63, - 69, + 8, + 9, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 9, + "line": 2, }, "start": Object { - "column": 14, - "line": 3, + "column": 2, + "line": 2, }, }, "range": Array [ - 70, - 71, + 12, + 19, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "private", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 13, + "line": 2, }, "start": Object { - "column": 16, - "line": 3, + "column": 10, + "line": 2, }, }, "range": Array [ - 72, - 73, + 20, + 23, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 14, + "line": 2, }, "start": Object { - "column": 17, - "line": 3, + "column": 13, + "line": 2, }, }, "range": Array [ - 73, - 74, + 23, + 24, ], "type": "Punctuator", - "value": ")", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 3, + "column": 16, + "line": 2, }, "start": Object { - "column": 19, - "line": 3, + "column": 15, + "line": 2, }, }, "range": Array [ - 75, - 77, + 25, + 26, ], "type": "Punctuator", - "value": "=>", + "value": "=", }, Object { "loc": Object { "end": Object { "column": 26, - "line": 3, + "line": 2, }, "start": Object { - "column": 22, - "line": 3, + "column": 17, + "line": 2, }, }, "range": Array [ - 78, - 82, + 27, + 36, ], - "type": "Identifier", - "value": "test", + "type": "Keyword", + "value": "undefined", }, Object { "loc": Object { "end": Object { "column": 27, - "line": 3, + "line": 2, }, "start": Object { "column": 26, - "line": 3, + "line": 2, }, }, "range": Array [ - 82, - 83, + 36, + 37, ], "type": "Punctuator", "value": ";", @@ -26094,16 +26742,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, - "line": 4, + "line": 3, }, }, "range": Array [ - 84, - 85, + 38, + 39, ], "type": "Punctuator", "value": "}", @@ -26113,7 +26761,7 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-property-values.src 1`] = ` +exports[`typescript fixtures/basics/class-with-private-parameter-properties.src 1`] = ` Object { "body": Array [ Object { @@ -26124,7 +26772,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 3, + "column": 13, "line": 2, }, "start": Object { @@ -26132,17 +26780,18 @@ Object { "line": 2, }, }, - "name": "a", + "name": "constructor", "range": Array [ 14, - 15, + 25, ], "type": "Identifier", }, + "kind": "constructor", "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 59, + "line": 5, }, "start": Object { "column": 2, @@ -26151,349 +26800,411 @@ Object { }, "range": Array [ 14, - 20, - ], - "static": false, - "type": "ClassProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 18, - 19, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "name": "b", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 23, - 30, + 201, ], "static": false, - "type": "ClassProperty", + "type": "MethodDefinition", "value": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "properties": Array [], - "range": Array [ - 27, - 29, - ], - "type": "ObjectExpression", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 57, + "line": 5, + }, }, + "range": Array [ + 199, + 201, + ], + "type": "BlockStatement", }, - "name": "c", - "range": Array [ - 33, - 34, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 33, - 40, - ], - "static": false, - "type": "ClassProperty", - "value": Object { - "elements": Array [], + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 8, - "line": 4, + "column": 59, + "line": 5, }, "start": Object { - "column": 6, - "line": 4, + "column": 13, + "line": 2, }, }, - "range": Array [ - 37, - 39, - ], - "type": "ArrayExpression", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "name": "d", - "range": Array [ - 43, - 44, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "range": Array [ - 43, - 50, - ], - "static": false, - "type": "ClassProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "range": Array [ - 47, - 49, - ], - "raw": "\\"\\"", - "type": "Literal", - "value": "", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 6, - }, - "start": Object { - "column": 2, - "line": 6, + "params": Array [ + Object { + "accessibility": "private", + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "firstName", + "range": Array [ + 34, + 51, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 43, + 51, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 26, + 51, + ], + "type": "TSParameterProperty", }, - }, - "name": "e", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 6, - }, - "start": Object { - "column": 2, - "line": 6, - }, - }, - "range": Array [ - 53, - 80, - ], - "static": false, - "type": "ClassProperty", - "value": Object { - "arguments": Array [ Object { - "elements": Array [ - Object { + "accessibility": "private", + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "name": "lastName", + "range": Array [ + 84, + 100, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 19, - "line": 6, + "column": 47, + "line": 3, }, "start": Object { - "column": 17, - "line": 6, + "column": 39, + "line": 3, }, }, - "properties": Array [], "range": Array [ - 68, - 70, + 92, + 100, ], - "type": "ObjectExpression", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 3, + }, + }, + "range": Array [ + 94, + 100, + ], + "type": "TSStringKeyword", + }, }, - Object { - "elements": Array [], + }, + "range": Array [ + 67, + 100, + ], + "readonly": true, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "parameter": Object { + "left": Object { "loc": Object { "end": Object { - "column": 23, - "line": 6, + "column": 33, + "line": 4, }, "start": Object { - "column": 21, - "line": 6, + "column": 22, + "line": 4, }, }, + "name": "age", "range": Array [ - 72, - 74, + 124, + 135, ], - "type": "ArrayExpression", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 127, + 135, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 129, + 135, + ], + "type": "TSNumberKeyword", + }, + }, }, - Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 124, + 140, + ], + "right": Object { "loc": Object { "end": Object { - "column": 26, - "line": 6, + "column": 38, + "line": 4, }, "start": Object { - "column": 25, - "line": 6, + "column": 36, + "line": 4, }, }, "range": Array [ - 76, - 77, + 138, + 140, ], - "raw": "2", + "raw": "30", "type": "Literal", - "value": 2, + "value": 30, }, + "type": "AssignmentPattern", + }, + "range": Array [ + 116, + 140, ], + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", "loc": Object { "end": Object { - "column": 27, - "line": 6, + "column": 55, + "line": 5, }, "start": Object { - "column": 16, - "line": 6, + "column": 14, + "line": 5, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 31, + "line": 5, + }, + }, + "name": "student", + "range": Array [ + 173, + 189, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 180, + 189, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 182, + 189, + ], + "type": "TSBooleanKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 31, + "line": 5, + }, }, + "range": Array [ + 173, + 197, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 50, + "line": 5, + }, + }, + "range": Array [ + 192, + 197, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "type": "AssignmentPattern", }, "range": Array [ - 67, - 78, + 156, + 197, ], - "type": "ArrayExpression", + "readonly": true, + "type": "TSParameterProperty", }, ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 6, - }, - "start": Object { - "column": 10, - "line": 6, - }, - }, - "name": "Array", - "range": Array [ - 61, - 66, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 6, - }, - "start": Object { - "column": 6, - "line": 6, - }, - }, "range": Array [ - 57, - 79, + 25, + 201, ], - "type": "NewExpression", + "type": "FunctionExpression", }, }, ], "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 6, }, "start": Object { "column": 10, @@ -26502,7 +27213,7 @@ Object { }, "range": Array [ 10, - 82, + 203, ], "type": "ClassBody", }, @@ -26527,7 +27238,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 6, }, "start": Object { "column": 0, @@ -26536,7 +27247,7 @@ Object { }, "range": Array [ 0, - 82, + 203, ], "superClass": null, "type": "ClassDeclaration", @@ -26544,8 +27255,8 @@ Object { ], "loc": Object { "end": Object { - "column": 0, - "line": 8, + "column": 1, + "line": 6, }, "start": Object { "column": 0, @@ -26554,7 +27265,7 @@ Object { }, "range": Array [ 0, - 83, + 203, ], "sourceType": "script", "tokens": Array [ @@ -26615,7 +27326,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 13, "line": 2, }, "start": Object { @@ -26625,349 +27336,313 @@ Object { }, "range": Array [ 14, - 15, + 25, ], "type": "Identifier", - "value": "a", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 14, "line": 2, }, "start": Object { - "column": 4, + "column": 13, "line": 2, }, }, "range": Array [ - 16, - 17, + 25, + 26, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 21, "line": 2, }, "start": Object { - "column": 6, + "column": 14, "line": 2, }, }, "range": Array [ - 18, - 19, + 26, + 33, ], - "type": "Numeric", - "value": "2", + "type": "Keyword", + "value": "private", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 31, "line": 2, }, "start": Object { - "column": 7, + "column": 22, "line": 2, }, }, "range": Array [ - 19, - 20, + 34, + 43, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "firstName", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 3, + "column": 32, + "line": 2, }, "start": Object { - "column": 2, - "line": 3, + "column": 31, + "line": 2, }, }, "range": Array [ - 23, - 24, + 43, + 44, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 39, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 33, + "line": 2, }, }, "range": Array [ - 25, - 26, + 45, + 51, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 40, + "line": 2, }, "start": Object { - "column": 6, - "line": 3, + "column": 39, + "line": 2, }, }, "range": Array [ - 27, - 28, + 51, + 52, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 21, "line": 3, }, "start": Object { - "column": 7, + "column": 14, "line": 3, }, }, "range": Array [ - 28, - 29, + 67, + 74, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "private", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 30, "line": 3, }, "start": Object { - "column": 8, + "column": 22, "line": 3, }, }, "range": Array [ - 29, - 30, + 75, + 83, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "readonly", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 39, + "line": 3, }, "start": Object { - "column": 2, - "line": 4, + "column": 31, + "line": 3, }, }, "range": Array [ - 33, - 34, + 84, + 92, ], "type": "Identifier", - "value": "c", + "value": "lastName", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 40, + "line": 3, }, "start": Object { - "column": 4, - "line": 4, + "column": 39, + "line": 3, }, }, "range": Array [ - 35, - 36, + 92, + 93, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 47, + "line": 3, }, "start": Object { - "column": 6, - "line": 4, + "column": 41, + "line": 3, }, }, "range": Array [ - 37, - 38, + 94, + 100, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 4, + "column": 48, + "line": 3, }, "start": Object { - "column": 7, - "line": 4, + "column": 47, + "line": 3, }, }, "range": Array [ - 38, - 39, + 100, + 101, ], "type": "Punctuator", - "value": "]", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 21, "line": 4, }, "start": Object { - "column": 8, + "column": 14, "line": 4, }, }, "range": Array [ - 39, - 40, + 116, + 123, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "private", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 25, + "line": 4, }, "start": Object { - "column": 2, - "line": 5, + "column": 22, + "line": 4, }, }, "range": Array [ - 43, - 44, + 124, + 127, ], "type": "Identifier", - "value": "d", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "range": Array [ - 45, - 46, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "range": Array [ - 47, - 49, - ], - "type": "String", - "value": "\\"\\"", + "value": "age", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 26, + "line": 4, }, "start": Object { - "column": 8, - "line": 5, + "column": 25, + "line": 4, }, }, "range": Array [ - 49, - 50, + 127, + 128, ], "type": "Punctuator", - "value": ";", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 6, + "column": 33, + "line": 4, }, "start": Object { - "column": 2, - "line": 6, + "column": 27, + "line": 4, }, }, "range": Array [ - 53, - 54, + 129, + 135, ], "type": "Identifier", - "value": "e", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 35, + "line": 4, }, "start": Object { - "column": 4, - "line": 6, + "column": 34, + "line": 4, }, }, "range": Array [ - 55, - 56, + 136, + 137, ], "type": "Punctuator", "value": "=", @@ -26975,269 +27650,233 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 6, - }, - "start": Object { - "column": 6, - "line": 6, - }, - }, - "range": Array [ - 57, - 60, - ], - "type": "Keyword", - "value": "new", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 6, - }, - "start": Object { - "column": 10, - "line": 6, - }, - }, - "range": Array [ - 61, - 66, - ], - "type": "Identifier", - "value": "Array", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 6, + "column": 38, + "line": 4, }, "start": Object { - "column": 15, - "line": 6, + "column": 36, + "line": 4, }, }, "range": Array [ - 66, - 67, + 138, + 140, ], - "type": "Punctuator", - "value": "(", + "type": "Numeric", + "value": "30", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 6, + "column": 39, + "line": 4, }, "start": Object { - "column": 16, - "line": 6, + "column": 38, + "line": 4, }, }, "range": Array [ - 67, - 68, + 140, + 141, ], "type": "Punctuator", - "value": "[", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 6, + "column": 21, + "line": 5, }, "start": Object { - "column": 17, - "line": 6, + "column": 14, + "line": 5, }, }, "range": Array [ - 68, - 69, + 156, + 163, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "private", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 6, + "column": 30, + "line": 5, }, "start": Object { - "column": 18, - "line": 6, + "column": 22, + "line": 5, }, }, "range": Array [ - 69, - 70, + 164, + 172, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "readonly", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 6, + "column": 38, + "line": 5, }, "start": Object { - "column": 19, - "line": 6, + "column": 31, + "line": 5, }, }, "range": Array [ - 70, - 71, + 173, + 180, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "student", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 6, + "column": 39, + "line": 5, }, "start": Object { - "column": 21, - "line": 6, + "column": 38, + "line": 5, }, }, "range": Array [ - 72, - 73, + 180, + 181, ], "type": "Punctuator", - "value": "[", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 6, + "column": 47, + "line": 5, }, "start": Object { - "column": 22, - "line": 6, + "column": 40, + "line": 5, }, }, "range": Array [ - 73, - 74, + 182, + 189, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 6, + "column": 49, + "line": 5, }, "start": Object { - "column": 23, - "line": 6, + "column": 48, + "line": 5, }, }, "range": Array [ - 74, - 75, + 190, + 191, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 6, + "column": 55, + "line": 5, }, "start": Object { - "column": 25, - "line": 6, + "column": 50, + "line": 5, }, }, "range": Array [ - 76, - 77, + 192, + 197, ], - "type": "Numeric", - "value": "2", + "type": "Boolean", + "value": "false", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 6, + "column": 56, + "line": 5, }, "start": Object { - "column": 26, - "line": 6, + "column": 55, + "line": 5, }, }, "range": Array [ - 77, - 78, + 197, + 198, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 6, + "column": 58, + "line": 5, }, "start": Object { - "column": 27, - "line": 6, + "column": 57, + "line": 5, }, }, "range": Array [ - 78, - 79, + 199, + 200, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 6, + "column": 59, + "line": 5, }, "start": Object { - "column": 28, - "line": 6, + "column": 58, + "line": 5, }, }, "range": Array [ - 79, - 80, + 200, + 201, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 6, }, "start": Object { "column": 0, - "line": 7, + "line": 6, }, }, "range": Array [ - 81, - 82, + 202, + 203, ], "type": "Punctuator", "value": "}", @@ -27247,7 +27886,7 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-protected-parameter-properties.src 1`] = ` +exports[`typescript fixtures/basics/class-with-property-function.src 1`] = ` Object { "body": Array [ Object { @@ -27255,10 +27894,11 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { - "column": 13, + "column": 5, "line": 2, }, "start": Object { @@ -27266,18 +27906,17 @@ Object { "line": 2, }, }, - "name": "constructor", + "name": "foo", "range": Array [ 14, - 25, + 17, ], "type": "Identifier", }, - "kind": "constructor", "loc": Object { "end": Object { - "column": 61, - "line": 5, + "column": 43, + "line": 2, }, "start": Object { "column": 2, @@ -27286,411 +27925,272 @@ Object { }, "range": Array [ 14, - 209, + 55, ], "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 61, - "line": 5, - }, - "start": Object { - "column": 59, - "line": 5, - }, - }, - "range": Array [ - 207, - 209, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 61, - "line": 5, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, }, "start": Object { - "column": 13, + "column": 5, "line": 2, }, }, - "params": Array [ - Object { - "accessibility": "protected", + "range": Array [ + 17, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 19, + 32, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 41, + "column": 20, "line": 2, }, "start": Object { - "column": 14, + "column": 10, "line": 2, }, }, - "parameter": Object { + "range": Array [ + 22, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 20, "line": 2, }, "start": Object { - "column": 24, + "column": 13, "line": 2, }, }, - "name": "firstName", "range": Array [ - 36, - 53, + 25, + 32, ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 2, - }, - "start": Object { - "column": 33, - "line": 2, - }, - }, - "range": Array [ - 45, - 53, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 2, - }, - "start": Object { - "column": 35, - "line": 2, - }, - }, - "range": Array [ - 47, - 53, - ], - "type": "TSStringKeyword", - }, - }, + "type": "TSBooleanKeyword", }, - "range": Array [ - 26, - 53, - ], - "type": "TSParameterProperty", }, - Object { - "accessibility": "protected", - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, + "type": "TSFunctionType", + }, + }, + "value": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "name": "lastName", - "range": Array [ - 88, - 104, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 41, - "line": 3, - }, - }, - "range": Array [ - 96, - 104, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 43, - "line": 3, - }, - }, - "range": Array [ - 98, - 104, - ], - "type": "TSStringKeyword", - }, - }, + "start": Object { + "column": 38, + "line": 2, }, - "range": Array [ - 69, - 104, - ], - "readonly": true, - "type": "TSParameterProperty", }, - Object { - "accessibility": "protected", - "loc": Object { - "end": Object { - "column": 40, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, - }, + "range": Array [ + 50, + 54, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 35, + 54, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, }, - "parameter": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 4, - }, - "start": Object { - "column": 24, - "line": 4, - }, - }, - "name": "age", - "range": Array [ - 130, - 141, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 4, - }, - "start": Object { - "column": 27, - "line": 4, - }, - }, - "range": Array [ - 133, - 141, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 4, - }, - "start": Object { - "column": 29, - "line": 4, - }, - }, - "range": Array [ - 135, - 141, - ], - "type": "TSNumberKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 40, - "line": 4, - }, - "start": Object { - "column": 24, - "line": 4, - }, - }, - "range": Array [ - 130, - 146, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 4, - }, - "start": Object { - "column": 38, - "line": 4, - }, - }, - "range": Array [ - 144, - 146, - ], - "raw": "30", - "type": "Literal", - "value": 30, - }, - "type": "AssignmentPattern", + "start": Object { + "column": 25, + "line": 2, }, - "range": Array [ - 120, - 146, - ], - "type": "TSParameterProperty", }, - Object { - "accessibility": "protected", + "range": Array [ + 37, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 57, - "line": 5, + "column": 34, + "line": 2, }, "start": Object { - "column": 14, - "line": 5, - }, - }, - "parameter": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 5, - }, - "start": Object { - "column": 33, - "line": 5, - }, - }, - "name": "student", - "range": Array [ - 181, - 197, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 5, - }, - "start": Object { - "column": 40, - "line": 5, - }, - }, - "range": Array [ - 188, - 197, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 5, - }, - "start": Object { - "column": 42, - "line": 5, - }, - }, - "range": Array [ - 190, - 197, - ], - "type": "TSBooleanKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 57, - "line": 5, - }, - "start": Object { - "column": 33, - "line": 5, - }, - }, - "range": Array [ - 181, - 205, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 5, - }, - "start": Object { - "column": 52, - "line": 5, - }, - }, - "range": Array [ - 200, - 205, - ], - "raw": "false", - "type": "Literal", - "value": false, + "column": 27, + "line": 2, }, - "type": "AssignmentPattern", }, "range": Array [ - 162, - 205, + 39, + 46, ], - "readonly": true, - "type": "TSParameterProperty", + "type": "TSBooleanKeyword", + }, + }, + "type": "ArrowFunctionExpression", + }, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, }, + }, + "name": "bar", + "range": Array [ + 58, + 61, ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 58, + 83, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, "range": Array [ - 25, - 209, + 61, + 69, ], - "type": "FunctionExpression", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 63, + 69, + ], + "type": "TSStringKeyword", + }, + }, + "value": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "name": "test", + "range": Array [ + 78, + 82, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 72, + 82, + ], + "type": "ArrowFunctionExpression", }, }, ], "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 4, }, "start": Object { "column": 10, @@ -27699,7 +28199,7 @@ Object { }, "range": Array [ 10, - 211, + 85, ], "type": "ClassBody", }, @@ -27724,7 +28224,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 4, }, "start": Object { "column": 0, @@ -27733,7 +28233,7 @@ Object { }, "range": Array [ 0, - 211, + 85, ], "superClass": null, "type": "ClassDeclaration", @@ -27741,8 +28241,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -27751,7 +28251,7 @@ Object { }, "range": Array [ 0, - 211, + 86, ], "sourceType": "script", "tokens": Array [ @@ -27812,7 +28312,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 5, "line": 2, }, "start": Object { @@ -27822,277 +28322,169 @@ Object { }, "range": Array [ 14, - 25, + 17, ], "type": "Identifier", - "value": "constructor", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 6, "line": 2, }, "start": Object { - "column": 13, + "column": 5, "line": 2, }, }, "range": Array [ - 25, - 26, + 17, + 18, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 8, "line": 2, }, "start": Object { - "column": 14, + "column": 7, "line": 2, }, }, "range": Array [ - 26, - 35, + 19, + 20, ], - "type": "Keyword", - "value": "protected", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 9, "line": 2, }, "start": Object { - "column": 24, + "column": 8, "line": 2, }, }, "range": Array [ - 36, - 45, + 20, + 21, ], - "type": "Identifier", - "value": "firstName", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 12, "line": 2, }, "start": Object { - "column": 33, + "column": 10, "line": 2, }, }, "range": Array [ - 45, - 46, + 22, + 24, ], "type": "Punctuator", - "value": ":", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 20, "line": 2, }, "start": Object { - "column": 35, + "column": 13, "line": 2, }, }, "range": Array [ - 47, - 53, + 25, + 32, ], "type": "Identifier", - "value": "string", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 22, "line": 2, }, "start": Object { - "column": 41, + "column": 21, "line": 2, }, }, "range": Array [ - 53, - 54, + 33, + 34, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 69, - 78, - ], - "type": "Keyword", - "value": "protected", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 3, - }, - "start": Object { "column": 24, - "line": 3, - }, - }, - "range": Array [ - 79, - 87, - ], - "type": "Identifier", - "value": "readonly", - }, - Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 88, - 96, - ], - "type": "Identifier", - "value": "lastName", - }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 3, - }, - "start": Object { - "column": 41, - "line": 3, - }, - }, - "range": Array [ - 96, - 97, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 43, - "line": 3, - }, - }, - "range": Array [ - 98, - 104, - ], - "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 3, + "line": 2, }, "start": Object { - "column": 49, - "line": 3, - }, - }, - "range": Array [ - 104, - 105, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { "column": 23, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, + "line": 2, }, }, "range": Array [ - 120, - 129, + 35, + 36, ], - "type": "Keyword", - "value": "protected", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 4, + "column": 25, + "line": 2, }, "start": Object { "column": 24, - "line": 4, + "line": 2, }, }, "range": Array [ - 130, - 133, + 36, + 37, ], - "type": "Identifier", - "value": "age", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 4, + "column": 26, + "line": 2, }, "start": Object { - "column": 27, - "line": 4, + "column": 25, + "line": 2, }, }, "range": Array [ - 133, - 134, + 37, + 38, ], "type": "Punctuator", "value": ":", @@ -28100,269 +28492,251 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, - "line": 4, + "column": 34, + "line": 2, }, "start": Object { - "column": 29, - "line": 4, + "column": 27, + "line": 2, }, }, "range": Array [ - 135, - 141, + 39, + 46, ], "type": "Identifier", - "value": "number", + "value": "boolean", }, Object { "loc": Object { "end": Object { "column": 37, - "line": 4, + "line": 2, }, "start": Object { - "column": 36, - "line": 4, + "column": 35, + "line": 2, }, }, "range": Array [ - 142, - 143, + 47, + 49, ], "type": "Punctuator", - "value": "=", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 4, + "column": 42, + "line": 2, }, "start": Object { "column": 38, - "line": 4, + "line": 2, }, }, "range": Array [ - 144, - 146, + 50, + 54, ], - "type": "Numeric", - "value": "30", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 4, + "column": 43, + "line": 2, }, "start": Object { - "column": 40, - "line": 4, + "column": 42, + "line": 2, }, }, "range": Array [ - 146, - 147, + 54, + 55, ], "type": "Punctuator", - "value": ",", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 5, + "column": 5, + "line": 3, }, "start": Object { - "column": 14, - "line": 5, + "column": 2, + "line": 3, }, }, "range": Array [ - 162, - 171, + 58, + 61, ], - "type": "Keyword", - "value": "protected", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 5, + "column": 6, + "line": 3, }, "start": Object { - "column": 24, - "line": 5, + "column": 5, + "line": 3, }, }, "range": Array [ - 172, - 180, + 61, + 62, ], - "type": "Identifier", - "value": "readonly", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 5, + "column": 13, + "line": 3, }, "start": Object { - "column": 33, - "line": 5, + "column": 7, + "line": 3, }, }, "range": Array [ - 181, - 188, + 63, + 69, ], "type": "Identifier", - "value": "student", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 5, + "column": 15, + "line": 3, }, "start": Object { - "column": 40, - "line": 5, + "column": 14, + "line": 3, }, }, "range": Array [ - 188, - 189, + 70, + 71, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 5, - }, - "start": Object { - "column": 42, - "line": 5, - }, - }, - "range": Array [ - 190, - 197, - ], - "type": "Identifier", - "value": "boolean", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 51, - "line": 5, + "column": 17, + "line": 3, }, "start": Object { - "column": 50, - "line": 5, + "column": 16, + "line": 3, }, }, "range": Array [ - 198, - 199, + 72, + 73, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 57, - "line": 5, + "column": 18, + "line": 3, }, "start": Object { - "column": 52, - "line": 5, + "column": 17, + "line": 3, }, }, "range": Array [ - 200, - 205, + 73, + 74, ], - "type": "Boolean", - "value": "false", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 58, - "line": 5, + "column": 21, + "line": 3, }, "start": Object { - "column": 57, - "line": 5, + "column": 19, + "line": 3, }, }, "range": Array [ - 205, - 206, + 75, + 77, ], "type": "Punctuator", - "value": ")", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 60, - "line": 5, + "column": 26, + "line": 3, }, "start": Object { - "column": 59, - "line": 5, + "column": 22, + "line": 3, }, }, "range": Array [ - 207, - 208, + 78, + 82, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "test", }, Object { "loc": Object { "end": Object { - "column": 61, - "line": 5, + "column": 27, + "line": 3, }, "start": Object { - "column": 60, - "line": 5, + "column": 26, + "line": 3, }, }, "range": Array [ - 208, - 209, + 82, + 83, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 4, }, "start": Object { "column": 0, - "line": 6, + "line": 4, }, }, "range": Array [ - 210, - 211, + 84, + 85, ], "type": "Punctuator", "value": "}", @@ -28372,7 +28746,7 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-public-parameter-properties.src 1`] = ` +exports[`typescript fixtures/basics/class-with-property-values.src 1`] = ` Object { "body": Array [ Object { @@ -28380,10 +28754,11 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { - "column": 13, + "column": 3, "line": 2, }, "start": Object { @@ -28391,18 +28766,17 @@ Object { "line": 2, }, }, - "name": "constructor", + "name": "a", "range": Array [ 14, - 25, + 15, ], "type": "Identifier", }, - "kind": "constructor", "loc": Object { "end": Object { - "column": 58, - "line": 5, + "column": 8, + "line": 2, }, "start": Object { "column": 2, @@ -28411,411 +28785,353 @@ Object { }, "range": Array [ 14, - 197, + 20, ], "static": false, - "type": "MethodDefinition", + "type": "ClassProperty", "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 58, - "line": 5, - }, - "start": Object { - "column": 56, - "line": 5, - }, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, }, - "range": Array [ - 195, - 197, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": false, - "id": null, + "range": Array [ + 18, + 19, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + }, + Object { + "computed": false, + "declare": false, + "key": Object { "loc": Object { "end": Object { - "column": 58, + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 23, + 30, + ], + "static": false, + "type": "ClassProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "properties": Array [], + "range": Array [ + 27, + 29, + ], + "type": "ObjectExpression", + }, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "c", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 33, + 40, + ], + "static": false, + "type": "ClassProperty", + "value": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 37, + 39, + ], + "type": "ArrayExpression", + }, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, "line": 5, }, "start": Object { - "column": 13, - "line": 2, + "column": 2, + "line": 5, }, }, - "params": Array [ - Object { - "accessibility": "public", - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "name": "firstName", - "range": Array [ - 33, - 50, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 42, - 50, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 32, - "line": 2, - }, - }, - "range": Array [ - 44, - 50, - ], - "type": "TSStringKeyword", - }, - }, - }, - "range": Array [ - 26, - 50, - ], - "type": "TSParameterProperty", + "name": "d", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 43, + 50, + ], + "static": false, + "type": "ClassProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 47, + 49, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + }, + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, }, + }, + "name": "e", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 53, + 80, + ], + "static": false, + "type": "ClassProperty", + "value": Object { + "arguments": Array [ Object { - "accessibility": "public", - "loc": Object { - "end": Object { - "column": 46, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "name": "lastName", - "range": Array [ - 82, - 98, - ], - "type": "Identifier", - "typeAnnotation": Object { + "elements": Array [ + Object { "loc": Object { "end": Object { - "column": 46, - "line": 3, + "column": 19, + "line": 6, }, "start": Object { - "column": 38, - "line": 3, + "column": 17, + "line": 6, }, }, + "properties": Array [], "range": Array [ - 90, - 98, + 68, + 70, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 3, - }, - "start": Object { - "column": 40, - "line": 3, - }, - }, - "range": Array [ - 92, - 98, - ], - "type": "TSStringKeyword", - }, - }, - }, - "range": Array [ - 66, - 98, - ], - "readonly": true, - "type": "TSParameterProperty", - }, - Object { - "accessibility": "public", - "loc": Object { - "end": Object { - "column": 37, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, + "type": "ObjectExpression", }, - }, - "parameter": Object { - "left": Object { + Object { + "elements": Array [], "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 23, + "line": 6, }, "start": Object { "column": 21, - "line": 4, + "line": 6, }, }, - "name": "age", "range": Array [ - 121, - 132, + 72, + 74, ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 4, - }, - "start": Object { - "column": 24, - "line": 4, - }, - }, - "range": Array [ - 124, - 132, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 4, - }, - "start": Object { - "column": 26, - "line": 4, - }, - }, - "range": Array [ - 126, - 132, - ], - "type": "TSNumberKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 4, - }, - "start": Object { - "column": 21, - "line": 4, - }, + "type": "ArrayExpression", }, - "range": Array [ - 121, - 137, - ], - "right": Object { + Object { "loc": Object { "end": Object { - "column": 37, - "line": 4, + "column": 26, + "line": 6, }, "start": Object { - "column": 35, - "line": 4, + "column": 25, + "line": 6, }, }, "range": Array [ - 135, - 137, + 76, + 77, ], - "raw": "30", + "raw": "2", "type": "Literal", - "value": 30, + "value": 2, }, - "type": "AssignmentPattern", - }, - "range": Array [ - 114, - 137, ], - "type": "TSParameterProperty", - }, - Object { - "accessibility": "public", "loc": Object { "end": Object { - "column": 54, - "line": 5, + "column": 27, + "line": 6, }, "start": Object { - "column": 14, - "line": 5, - }, - }, - "parameter": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 5, - }, - "start": Object { - "column": 30, - "line": 5, - }, - }, - "name": "student", - "range": Array [ - 169, - 185, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 5, - }, - "start": Object { - "column": 37, - "line": 5, - }, - }, - "range": Array [ - 176, - 185, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 5, - }, - "start": Object { - "column": 39, - "line": 5, - }, - }, - "range": Array [ - 178, - 185, - ], - "type": "TSBooleanKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { - "column": 30, - "line": 5, - }, - }, - "range": Array [ - 169, - 193, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { - "column": 49, - "line": 5, - }, - }, - "range": Array [ - 188, - 193, - ], - "raw": "false", - "type": "Literal", - "value": false, + "column": 16, + "line": 6, }, - "type": "AssignmentPattern", }, "range": Array [ - 153, - 193, + 67, + 78, ], - "readonly": true, - "type": "TSParameterProperty", + "type": "ArrayExpression", }, ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "name": "Array", + "range": Array [ + 61, + 66, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, "range": Array [ - 25, - 197, + 57, + 79, ], - "type": "FunctionExpression", + "type": "NewExpression", }, }, ], "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 7, }, "start": Object { "column": 10, @@ -28824,7 +29140,7 @@ Object { }, "range": Array [ 10, - 199, + 82, ], "type": "ClassBody", }, @@ -28849,7 +29165,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 7, }, "start": Object { "column": 0, @@ -28858,7 +29174,7 @@ Object { }, "range": Array [ 0, - 199, + 82, ], "superClass": null, "type": "ClassDeclaration", @@ -28866,8 +29182,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -28876,7 +29192,7 @@ Object { }, "range": Array [ 0, - 199, + 83, ], "sourceType": "script", "tokens": Array [ @@ -28937,7 +29253,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 3, "line": 2, }, "start": Object { @@ -28947,313 +29263,277 @@ Object { }, "range": Array [ 14, - 25, + 15, ], "type": "Identifier", - "value": "constructor", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 5, "line": 2, }, "start": Object { - "column": 13, + "column": 4, "line": 2, }, }, "range": Array [ - 25, - 26, + 16, + 17, ], "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 26, - 32, - ], - "type": "Keyword", - "value": "public", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 7, "line": 2, }, "start": Object { - "column": 21, + "column": 6, "line": 2, }, }, "range": Array [ - 33, - 42, + 18, + 19, ], - "type": "Identifier", - "value": "firstName", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 8, "line": 2, }, "start": Object { - "column": 30, + "column": 7, "line": 2, }, }, "range": Array [ - 42, - 43, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 3, + "line": 3, }, "start": Object { - "column": 32, - "line": 2, + "column": 2, + "line": 3, }, }, "range": Array [ - 44, - 50, + 23, + 24, ], "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 38, - "line": 2, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": ",", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 5, "line": 3, }, "start": Object { - "column": 14, + "column": 4, "line": 3, }, }, "range": Array [ - 66, - 72, + 25, + 26, ], - "type": "Keyword", - "value": "public", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 7, "line": 3, }, "start": Object { - "column": 21, + "column": 6, "line": 3, }, }, "range": Array [ - 73, - 81, + 27, + 28, ], - "type": "Identifier", - "value": "readonly", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 8, "line": 3, }, "start": Object { - "column": 30, + "column": 7, "line": 3, }, }, "range": Array [ - 82, - 90, + 28, + 29, ], - "type": "Identifier", - "value": "lastName", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 9, "line": 3, }, "start": Object { - "column": 38, + "column": 8, "line": 3, }, }, "range": Array [ - 90, - 91, + 29, + 30, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 3, + "column": 3, + "line": 4, }, "start": Object { - "column": 40, - "line": 3, + "column": 2, + "line": 4, }, }, "range": Array [ - 92, - 98, + 33, + 34, ], "type": "Identifier", - "value": "string", + "value": "c", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { - "column": 46, - "line": 3, + "column": 4, + "line": 4, }, }, "range": Array [ - 98, - 99, + 35, + 36, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 7, "line": 4, }, "start": Object { - "column": 14, + "column": 6, "line": 4, }, }, "range": Array [ - 114, - 120, + 37, + 38, ], - "type": "Keyword", - "value": "public", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 8, "line": 4, }, "start": Object { - "column": 21, + "column": 7, "line": 4, }, }, "range": Array [ - 121, - 124, + 38, + 39, ], - "type": "Identifier", - "value": "age", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 9, "line": 4, }, "start": Object { - "column": 24, + "column": 8, "line": 4, }, }, "range": Array [ - 124, - 125, + 39, + 40, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 4, + "column": 3, + "line": 5, }, "start": Object { - "column": 26, - "line": 4, + "column": 2, + "line": 5, }, }, "range": Array [ - 126, - 132, + 43, + 44, ], "type": "Identifier", - "value": "number", + "value": "d", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 4, + "column": 5, + "line": 5, }, "start": Object { - "column": 33, - "line": 4, + "column": 4, + "line": 5, }, }, "range": Array [ - 133, - 134, + 45, + 46, ], "type": "Punctuator", "value": "=", @@ -29261,234 +29541,342 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, - "line": 4, + "column": 8, + "line": 5, }, "start": Object { - "column": 35, - "line": 4, + "column": 6, + "line": 5, }, }, "range": Array [ - 135, - 137, + 47, + 49, ], - "type": "Numeric", - "value": "30", + "type": "String", + "value": "\\"\\"", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 4, + "column": 9, + "line": 5, }, "start": Object { - "column": 37, - "line": 4, + "column": 8, + "line": 5, }, }, "range": Array [ - 137, - 138, + 49, + 50, ], "type": "Punctuator", - "value": ",", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 5, + "column": 3, + "line": 6, }, "start": Object { - "column": 14, - "line": 5, + "column": 2, + "line": 6, }, }, "range": Array [ - 153, - 159, + 53, + 54, ], - "type": "Keyword", - "value": "public", + "type": "Identifier", + "value": "e", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 5, + "column": 5, + "line": 6, }, "start": Object { - "column": 21, - "line": 5, + "column": 4, + "line": 6, }, }, "range": Array [ - 160, - 168, + 55, + 56, ], - "type": "Identifier", - "value": "readonly", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 5, + "column": 9, + "line": 6, }, "start": Object { - "column": 30, - "line": 5, + "column": 6, + "line": 6, }, }, "range": Array [ - 169, - 176, + 57, + 60, ], - "type": "Identifier", - "value": "student", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 5, + "column": 15, + "line": 6, }, "start": Object { - "column": 37, - "line": 5, + "column": 10, + "line": 6, }, }, "range": Array [ - 176, - 177, + 61, + 66, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "Array", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 5, + "column": 16, + "line": 6, }, "start": Object { - "column": 39, - "line": 5, + "column": 15, + "line": 6, }, }, "range": Array [ - 178, - 185, + 66, + 67, ], - "type": "Identifier", - "value": "boolean", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 48, - "line": 5, + "column": 17, + "line": 6, }, "start": Object { - "column": 47, - "line": 5, + "column": 16, + "line": 6, }, }, "range": Array [ - 186, - 187, + 67, + 68, ], "type": "Punctuator", - "value": "=", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 54, - "line": 5, + "column": 18, + "line": 6, }, "start": Object { - "column": 49, - "line": 5, + "column": 17, + "line": 6, }, }, "range": Array [ - 188, - 193, + 68, + 69, ], - "type": "Boolean", - "value": "false", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 55, - "line": 5, + "column": 19, + "line": 6, }, "start": Object { - "column": 54, - "line": 5, + "column": 18, + "line": 6, }, }, "range": Array [ - 193, - 194, + 69, + 70, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 57, - "line": 5, + "column": 20, + "line": 6, }, "start": Object { - "column": 56, - "line": 5, + "column": 19, + "line": 6, }, }, "range": Array [ - 195, - 196, + 70, + 71, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 58, - "line": 5, + "column": 22, + "line": 6, }, "start": Object { - "column": 57, - "line": 5, + "column": 21, + "line": 6, }, }, "range": Array [ - 196, - 197, + 72, + 73, ], "type": "Punctuator", - "value": "}", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 23, "line": 6, }, "start": Object { - "column": 0, + "column": 22, "line": 6, }, }, "range": Array [ - 198, - 199, - ], + 73, + 74, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 25, + "line": 6, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 6, + }, + "start": Object { + "column": 26, + "line": 6, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 6, + }, + "start": Object { + "column": 28, + "line": 6, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 81, + 82, + ], "type": "Punctuator", "value": "}", }, @@ -29497,7 +29885,7 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-readonly-parameter-properties.src 1`] = ` +exports[`typescript fixtures/basics/class-with-protected-parameter-properties.src 1`] = ` Object { "body": Array [ Object { @@ -29526,8 +29914,8 @@ Object { "kind": "constructor", "loc": Object { "end": Object { - "column": 53, - "line": 3, + "column": 61, + "line": 5, }, "start": Object { "column": 2, @@ -29536,7 +29924,7 @@ Object { }, "range": Array [ 14, - 107, + 209, ], "static": false, "type": "MethodDefinition", @@ -29546,17 +29934,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 53, - "line": 3, + "column": 61, + "line": 5, }, "start": Object { - "column": 51, - "line": 3, + "column": 59, + "line": 5, }, }, "range": Array [ - 105, - 107, + 207, + 209, ], "type": "BlockStatement", }, @@ -29565,8 +29953,8 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 53, - "line": 3, + "column": 61, + "line": 5, }, "start": Object { "column": 13, @@ -29575,9 +29963,10 @@ Object { }, "params": Array [ Object { + "accessibility": "protected", "loc": Object { "end": Object { - "column": 40, + "column": 41, "line": 2, }, "start": Object { @@ -29588,50 +29977,50 @@ Object { "parameter": Object { "loc": Object { "end": Object { - "column": 40, + "column": 41, "line": 2, }, "start": Object { - "column": 23, + "column": 24, "line": 2, }, }, "name": "firstName", "range": Array [ - 35, - 52, + 36, + 53, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 40, + "column": 41, "line": 2, }, "start": Object { - "column": 32, + "column": 33, "line": 2, }, }, "range": Array [ - 44, - 52, + 45, + 53, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 40, + "column": 41, "line": 2, }, "start": Object { - "column": 34, + "column": 35, "line": 2, }, }, "range": Array [ - 46, - 52, + 47, + 53, ], "type": "TSStringKeyword", }, @@ -29639,12 +30028,12 @@ Object { }, "range": Array [ 26, - 52, + 53, ], - "readonly": true, "type": "TSParameterProperty", }, Object { + "accessibility": "protected", "loc": Object { "end": Object { "column": 49, @@ -29656,96 +30045,273 @@ Object { }, }, "parameter": Object { - "left": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "name": "lastName", + "range": Array [ + 88, + 104, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 39, + "column": 49, "line": 3, }, "start": Object { - "column": 23, + "column": 41, "line": 3, }, }, - "name": "lastName", "range": Array [ - 77, - 93, + 96, + 104, ], - "type": "Identifier", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 39, + "column": 49, "line": 3, }, "start": Object { - "column": 31, + "column": 43, "line": 3, }, }, "range": Array [ - 85, - 93, + 98, + 104, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 69, + 104, + ], + "readonly": true, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "protected", + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "name": "age", + "range": Array [ + 130, + 141, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 133, + 141, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 39, - "line": 3, + "column": 35, + "line": 4, }, "start": Object { - "column": 33, - "line": 3, + "column": 29, + "line": 4, }, }, "range": Array [ - 87, - 93, + 135, + 141, ], - "type": "TSStringKeyword", + "type": "TSNumberKeyword", }, }, }, "loc": Object { "end": Object { - "column": 49, - "line": 3, + "column": 40, + "line": 4, }, "start": Object { - "column": 23, - "line": 3, + "column": 24, + "line": 4, }, }, "range": Array [ - 77, - 103, + 130, + 146, ], "right": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 38, + "line": 4, + }, + }, + "range": Array [ + 144, + 146, + ], + "raw": "30", + "type": "Literal", + "value": 30, + }, + "type": "AssignmentPattern", + }, + "range": Array [ + 120, + 146, + ], + "type": "TSParameterProperty", + }, + Object { + "accessibility": "protected", + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "parameter": Object { + "left": Object { "loc": Object { "end": Object { "column": 49, - "line": 3, + "line": 5, }, "start": Object { - "column": 42, - "line": 3, + "column": 33, + "line": 5, }, }, + "name": "student", "range": Array [ - 96, - 103, + 181, + 197, ], - "raw": "'Smith'", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 188, + 197, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "range": Array [ + 190, + 197, + ], + "type": "TSBooleanKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "range": Array [ + 181, + 205, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 52, + "line": 5, + }, + }, + "range": Array [ + 200, + 205, + ], + "raw": "false", "type": "Literal", - "value": "Smith", + "value": false, }, "type": "AssignmentPattern", }, "range": Array [ - 68, - 103, + 162, + 205, ], "readonly": true, "type": "TSParameterProperty", @@ -29753,7 +30319,7 @@ Object { ], "range": Array [ 25, - 107, + 209, ], "type": "FunctionExpression", }, @@ -29762,7 +30328,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 6, }, "start": Object { "column": 10, @@ -29771,7 +30337,7 @@ Object { }, "range": Array [ 10, - 109, + 211, ], "type": "ClassBody", }, @@ -29796,7 +30362,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -29805,7 +30371,7 @@ Object { }, "range": Array [ 0, - 109, + 211, ], "superClass": null, "type": "ClassDeclaration", @@ -29814,7 +30380,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -29823,7 +30389,7 @@ Object { }, "range": Array [ 0, - 109, + 211, ], "sourceType": "script", "tokens": Array [ @@ -29920,7 +30486,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 23, "line": 2, }, "start": Object { @@ -29930,25 +30496,25 @@ Object { }, "range": Array [ 26, - 34, + 35, ], - "type": "Identifier", - "value": "readonly", + "type": "Keyword", + "value": "protected", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 33, "line": 2, }, "start": Object { - "column": 23, + "column": 24, "line": 2, }, }, "range": Array [ - 35, - 44, + 36, + 45, ], "type": "Identifier", "value": "firstName", @@ -29956,17 +30522,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 34, "line": 2, }, "start": Object { - "column": 32, + "column": 33, "line": 2, }, }, "range": Array [ - 44, 45, + 46, ], "type": "Punctuator", "value": ":", @@ -29974,17 +30540,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 40, + "column": 41, "line": 2, }, "start": Object { - "column": 34, + "column": 35, "line": 2, }, }, "range": Array [ - 46, - 52, + 47, + 53, ], "type": "Identifier", "value": "string", @@ -29992,17 +30558,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 42, "line": 2, }, "start": Object { - "column": 40, + "column": 41, "line": 2, }, }, "range": Array [ - 52, 53, + 54, ], "type": "Punctuator", "value": ",", @@ -30010,7 +30576,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 23, "line": 3, }, "start": Object { @@ -30019,8 +30585,26 @@ Object { }, }, "range": Array [ - 68, - 76, + 69, + 78, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 79, + 87, ], "type": "Identifier", "value": "readonly", @@ -30028,17 +30612,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 41, "line": 3, }, "start": Object { - "column": 23, + "column": 33, "line": 3, }, }, "range": Array [ - 77, - 85, + 88, + 96, ], "type": "Identifier", "value": "lastName", @@ -30046,17 +30630,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 42, "line": 3, }, "start": Object { - "column": 31, + "column": 41, "line": 3, }, }, "range": Array [ - 85, - 86, + 96, + 97, ], "type": "Punctuator", "value": ":", @@ -30064,17 +30648,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, + "column": 49, "line": 3, }, "start": Object { - "column": 33, + "column": 43, "line": 3, }, }, "range": Array [ - 87, - 93, + 98, + 104, ], "type": "Identifier", "value": "string", @@ -30082,425 +30666,341 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 50, "line": 3, }, "start": Object { - "column": 40, + "column": 49, "line": 3, }, }, "range": Array [ - 94, - 95, + 104, + 105, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 49, - "line": 3, + "column": 23, + "line": 4, }, "start": Object { - "column": 42, - "line": 3, + "column": 14, + "line": 4, }, }, "range": Array [ - 96, - 103, + 120, + 129, ], - "type": "String", - "value": "'Smith'", + "type": "Keyword", + "value": "protected", }, Object { "loc": Object { "end": Object { - "column": 50, - "line": 3, + "column": 27, + "line": 4, }, "start": Object { - "column": 49, - "line": 3, + "column": 24, + "line": 4, }, }, "range": Array [ - 103, - 104, + 130, + 133, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "age", }, Object { "loc": Object { "end": Object { - "column": 52, - "line": 3, + "column": 28, + "line": 4, }, "start": Object { - "column": 51, - "line": 3, + "column": 27, + "line": 4, }, }, "range": Array [ - 105, - 106, + 133, + 134, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 53, - "line": 3, + "column": 35, + "line": 4, }, "start": Object { - "column": 52, - "line": 3, + "column": 29, + "line": 4, }, }, "range": Array [ - 106, - 107, + 135, + 141, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 37, "line": 4, }, "start": Object { - "column": 0, + "column": 36, "line": 4, }, }, "range": Array [ - 108, - 109, + 142, + 143, ], "type": "Punctuator", - "value": "}", + "value": "=", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-readonly-property.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": "public", - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 16, - 47, - ], - "readonly": true, - "static": false, - "type": "ClassProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 2, - }, - "start": Object { - "column": 26, - "line": 2, - }, - }, - "range": Array [ - 38, - 46, - ], - "raw": "'string'", - "type": "Literal", - "value": "string", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 40, + "line": 4, }, - "range": Array [ - 10, - 49, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 38, + "line": 4, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, + "range": Array [ + 144, + 146, + ], + "type": "Numeric", + "value": "30", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 41, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 40, + "line": 4, }, }, "range": Array [ - 0, - 49, + 146, + 147, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ",", }, - }, - "range": Array [ - 0, - 50, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 23, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 14, + "line": 5, }, }, "range": Array [ - 0, - 5, + 162, + 171, ], "type": "Keyword", - "value": "class", + "value": "protected", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 32, + "line": 5, }, "start": Object { - "column": 6, - "line": 1, + "column": 24, + "line": 5, }, }, "range": Array [ - 6, - 9, + 172, + 180, ], "type": "Identifier", - "value": "Foo", + "value": "readonly", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 40, + "line": 5, }, "start": Object { - "column": 10, - "line": 1, + "column": 33, + "line": 5, }, }, "range": Array [ - 10, - 11, + 181, + 188, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "student", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 41, + "line": 5, }, "start": Object { - "column": 4, - "line": 2, + "column": 40, + "line": 5, }, }, "range": Array [ - 16, - 22, + 188, + 189, ], - "type": "Keyword", - "value": "public", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 49, + "line": 5, }, "start": Object { - "column": 11, - "line": 2, + "column": 42, + "line": 5, }, }, "range": Array [ - 23, - 31, + 190, + 197, ], "type": "Identifier", - "value": "readonly", + "value": "boolean", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 51, + "line": 5, }, "start": Object { - "column": 20, - "line": 2, + "column": 50, + "line": 5, }, }, "range": Array [ - 32, - 35, + 198, + 199, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 57, + "line": 5, }, "start": Object { - "column": 24, - "line": 2, + "column": 52, + "line": 5, }, }, "range": Array [ - 36, - 37, + 200, + 205, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 57, + "line": 5, + }, + }, + "range": Array [ + 205, + 206, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 60, + "line": 5, }, "start": Object { - "column": 26, - "line": 2, + "column": 59, + "line": 5, }, }, "range": Array [ - 38, - 46, + 207, + 208, ], - "type": "String", - "value": "'string'", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 2, + "column": 61, + "line": 5, }, "start": Object { - "column": 34, - "line": 2, + "column": 60, + "line": 5, }, }, "range": Array [ - 46, - 47, + 208, + 209, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { "column": 0, - "line": 3, + "line": 6, }, }, "range": Array [ - 48, - 49, + 210, + 211, ], "type": "Punctuator", "value": "}", @@ -30510,7 +31010,7 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-static-parameter-properties.src 1`] = ` +exports[`typescript fixtures/basics/class-with-public-parameter-properties.src 1`] = ` Object { "body": Array [ Object { @@ -30521,35 +31021,35 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 15, + "column": 13, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "name": "constructor", "range": Array [ - 16, - 27, + 14, + 25, ], "type": "Identifier", }, "kind": "constructor", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 58, + "line": 5, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 16, - 54, + 14, + 197, ], "static": false, "type": "MethodDefinition", @@ -30559,17 +31059,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 58, + "line": 5, }, "start": Object { - "column": 34, - "line": 2, + "column": 56, + "line": 5, }, }, "range": Array [ - 46, - 54, + 195, + 197, ], "type": "BlockStatement", }, @@ -30578,762 +31078,398 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 58, + "line": 5, }, "start": Object { - "column": 15, + "column": 13, "line": 2, }, }, "params": Array [ Object { + "accessibility": "public", "loc": Object { "end": Object { - "column": 32, + "column": 38, "line": 2, }, "start": Object { - "column": 16, + "column": 14, "line": 2, }, }, "parameter": Object { "loc": Object { "end": Object { - "column": 32, + "column": 38, "line": 2, }, "start": Object { - "column": 23, + "column": 21, "line": 2, }, }, - "name": "a", + "name": "firstName", "range": Array [ - 35, - 44, + 33, + 50, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 32, + "column": 38, "line": 2, }, "start": Object { - "column": 24, + "column": 30, "line": 2, }, }, "range": Array [ - 36, - 44, + 42, + 50, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 32, + "column": 38, "line": 2, }, "start": Object { - "column": 26, + "column": 32, "line": 2, }, }, "range": Array [ - 38, 44, + 50, ], "type": "TSStringKeyword", }, }, }, "range": Array [ - 28, - 44, + 26, + 50, ], - "static": true, "type": "TSParameterProperty", }, - ], - "range": Array [ - 27, - 54, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 56, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 56, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 8, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 59, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - "value": "Foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 16, - 27, - ], - "type": "Identifier", - "value": "constructor", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 27, - 28, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 28, - 34, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "range": Array [ - 36, - 37, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 26, - "line": 2, - }, - }, - "range": Array [ - 38, - 44, - ], - "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 32, - "line": 2, - }, - }, - "range": Array [ - 44, - 45, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 46, - 47, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, - }, - }, - "range": Array [ - 55, - 56, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-two-methods-computed-constructor.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 12, - 25, - ], - "raw": "\\"constructor\\"", - "type": "Literal", - "value": "constructor", - }, - "kind": "constructor", - "loc": Object { - "end": Object { - "column": 3, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 12, - 44, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 3, - "line": 3, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "range": Array [ - 39, - 44, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 3, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 25, - 44, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 30, - 38, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + Object { + "accessibility": "public", "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 46, + "line": 3, }, "start": Object { - "column": 22, - "line": 2, + "column": 14, + "line": 3, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "name": "lastName", + "range": Array [ + 82, + 98, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 90, + 98, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 92, + 98, + ], + "type": "TSStringKeyword", + }, }, }, "range": Array [ - 32, - 38, + 66, + 98, ], - "type": "TSNumberKeyword", + "readonly": true, + "type": "TSParameterProperty", }, - }, - "type": "FunctionExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, + Object { + "accessibility": "public", + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, }, - }, - "params": Array [ - Object { + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "name": "age", + "range": Array [ + 121, + 132, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 124, + 132, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "TSNumberKeyword", + }, + }, + }, "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 37, + "line": 4, }, "start": Object { - "column": 16, - "line": 2, + "column": 21, + "line": 4, }, }, - "name": Object { + "range": Array [ + 121, + 137, + ], + "right": Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 37, + "line": 4, }, "start": Object { - "column": 16, - "line": 2, + "column": 35, + "line": 4, }, }, - "name": "T", "range": Array [ - 26, - 27, + 135, + 137, ], - "type": "Identifier", + "raw": "30", + "type": "Literal", + "value": 30, }, - "range": Array [ - 26, - 27, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 25, - 28, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - }, - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 5, - }, - "start": Object { - "column": 3, - "line": 5, - }, - }, - "range": Array [ - 49, - 62, - ], - "raw": "\\"constructor\\"", - "type": "Literal", - "value": "constructor", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 3, - "line": 6, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "range": Array [ - 48, - 82, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 3, - "line": 6, - }, - "start": Object { - "column": 31, - "line": 5, - }, - }, - "range": Array [ - 77, - 82, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 3, - "line": 6, - }, - "start": Object { - "column": 17, - "line": 5, - }, - }, - "params": Array [], - "range": Array [ - 63, - 82, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 5, - }, - "start": Object { - "column": 22, - "line": 5, + "type": "AssignmentPattern", }, + "range": Array [ + 114, + 137, + ], + "type": "TSParameterProperty", }, - "range": Array [ - 68, - 76, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + Object { + "accessibility": "public", "loc": Object { "end": Object { - "column": 30, + "column": 54, "line": 5, }, "start": Object { - "column": 24, + "column": 14, "line": 5, }, }, - "range": Array [ - 70, - 76, - ], - "type": "TSNumberKeyword", - }, - }, - "type": "FunctionExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 5, - }, - "start": Object { - "column": 17, - "line": 5, - }, - }, - "params": Array [ - Object { + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "name": "student", + "range": Array [ + 169, + 185, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 176, + 185, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, + }, + }, + "range": Array [ + 178, + 185, + ], + "type": "TSBooleanKeyword", + }, + }, + }, "loc": Object { "end": Object { - "column": 19, + "column": 54, "line": 5, }, "start": Object { - "column": 18, + "column": 30, "line": 5, }, }, - "name": Object { + "range": Array [ + 169, + 193, + ], + "right": Object { "loc": Object { "end": Object { - "column": 19, + "column": 54, "line": 5, }, "start": Object { - "column": 18, + "column": 49, "line": 5, }, }, - "name": "T", "range": Array [ - 64, - 65, + 188, + 193, ], - "type": "Identifier", + "raw": "false", + "type": "Literal", + "value": false, }, - "range": Array [ - 64, - 65, - ], - "type": "TSTypeParameter", + "type": "AssignmentPattern", }, - ], - "range": Array [ - 63, - 66, - ], - "type": "TSTypeParameterDeclaration", - }, + "range": Array [ + 153, + 193, + ], + "readonly": true, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 25, + 197, + ], + "type": "FunctionExpression", }, }, ], "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 6, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 84, + 10, + 199, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -31341,17 +31477,17 @@ Object { "line": 1, }, }, - "name": "A", + "name": "Foo", "range": Array [ 6, - 7, + 9, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 6, }, "start": Object { "column": 0, @@ -31360,33 +31496,16 @@ Object { }, "range": Array [ 0, - 84, + 199, ], "superClass": null, "type": "ClassDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 7, - }, - "start": Object { - "column": 1, - "line": 7, - }, - }, - "range": Array [ - 84, - 85, - ], - "type": "EmptyStatement", - }, ], "loc": Object { "end": Object { - "column": 0, - "line": 8, + "column": 1, + "line": 6, }, "start": Object { "column": 0, @@ -31395,7 +31514,7 @@ Object { }, "range": Array [ 0, - 86, + 199, ], "sourceType": "script", "tokens": Array [ @@ -31420,7 +31539,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -31430,25 +31549,25 @@ Object { }, "range": Array [ 6, - 7, + 9, ], "type": "Identifier", - "value": "A", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 9, + 10, + 11, ], "type": "Punctuator", "value": "{", @@ -31456,7 +31575,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 13, "line": 2, }, "start": Object { @@ -31465,20 +31584,20 @@ Object { }, }, "range": Array [ - 12, + 14, 25, ], - "type": "String", - "value": "\\"constructor\\"", + "type": "Identifier", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 14, "line": 2, }, "start": Object { - "column": 15, + "column": 13, "line": 2, }, }, @@ -31487,659 +31606,526 @@ Object { 26, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 20, "line": 2, }, "start": Object { - "column": 16, + "column": 14, "line": 2, }, }, "range": Array [ 26, - 27, + 32, ], - "type": "Identifier", - "value": "T", + "type": "Keyword", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 30, "line": 2, }, "start": Object { - "column": 17, + "column": 21, "line": 2, }, }, "range": Array [ - 27, - 28, + 33, + 42, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "firstName", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 31, "line": 2, }, "start": Object { - "column": 18, + "column": 30, "line": 2, }, }, "range": Array [ - 28, - 29, + 42, + 43, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 38, "line": 2, }, "start": Object { - "column": 19, + "column": 32, "line": 2, }, }, "range": Array [ - 29, - 30, + 44, + 50, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 39, "line": 2, }, "start": Object { - "column": 20, + "column": 38, "line": 2, }, }, "range": Array [ - 30, - 31, + 50, + 51, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 20, + "line": 3, }, "start": Object { - "column": 22, - "line": 2, + "column": 14, + "line": 3, }, }, "range": Array [ - 32, - 38, + 66, + 72, ], - "type": "Identifier", - "value": "number", + "type": "Keyword", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 2, + "column": 29, + "line": 3, }, "start": Object { - "column": 29, - "line": 2, + "column": 21, + "line": 3, }, }, "range": Array [ - 39, - 40, + 73, + 81, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "readonly", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 38, "line": 3, }, "start": Object { - "column": 2, + "column": 30, "line": 3, }, }, "range": Array [ - 43, - 44, + 82, + 90, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "lastName", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 39, + "line": 3, }, "start": Object { - "column": 2, - "line": 5, + "column": 38, + "line": 3, }, }, "range": Array [ - 48, - 49, + 90, + 91, ], "type": "Punctuator", - "value": "[", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 46, + "line": 3, }, "start": Object { - "column": 3, - "line": 5, + "column": 40, + "line": 3, }, }, "range": Array [ - 49, - 62, + 92, + 98, ], - "type": "String", - "value": "\\"constructor\\"", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 5, + "column": 47, + "line": 3, }, "start": Object { - "column": 16, - "line": 5, + "column": 46, + "line": 3, }, }, "range": Array [ - 62, - 63, + 98, + 99, ], "type": "Punctuator", - "value": "]", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 5, + "column": 20, + "line": 4, }, "start": Object { - "column": 17, - "line": 5, + "column": 14, + "line": 4, }, }, "range": Array [ - 63, - 64, + 114, + 120, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 5, + "column": 24, + "line": 4, }, "start": Object { - "column": 18, - "line": 5, + "column": 21, + "line": 4, }, }, "range": Array [ - 64, - 65, + 121, + 124, ], "type": "Identifier", - "value": "T", + "value": "age", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 5, + "column": 25, + "line": 4, }, "start": Object { - "column": 19, - "line": 5, + "column": 24, + "line": 4, }, }, "range": Array [ - 65, - 66, + 124, + 125, ], "type": "Punctuator", - "value": ">", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 5, + "column": 32, + "line": 4, }, "start": Object { - "column": 20, - "line": 5, + "column": 26, + "line": 4, }, }, "range": Array [ - 66, - 67, + 126, + 132, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 5, + "column": 34, + "line": 4, }, "start": Object { - "column": 21, - "line": 5, + "column": 33, + "line": 4, }, }, "range": Array [ - 67, - 68, + 133, + 134, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 5, + "column": 37, + "line": 4, }, "start": Object { - "column": 22, - "line": 5, + "column": 35, + "line": 4, }, }, "range": Array [ - 68, - 69, + 135, + 137, ], - "type": "Punctuator", - "value": ":", + "type": "Numeric", + "value": "30", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 5, + "column": 38, + "line": 4, }, "start": Object { - "column": 24, - "line": 5, + "column": 37, + "line": 4, }, }, "range": Array [ - 70, - 76, + 137, + 138, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 20, "line": 5, }, "start": Object { - "column": 31, + "column": 14, "line": 5, }, }, "range": Array [ - 77, - 78, + 153, + 159, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 6, + "column": 29, + "line": 5, }, "start": Object { - "column": 2, - "line": 6, + "column": 21, + "line": 5, }, }, "range": Array [ - 81, - 82, + 160, + 168, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "readonly", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 37, + "line": 5, }, "start": Object { - "column": 0, - "line": 7, + "column": 30, + "line": 5, }, }, "range": Array [ - 83, - 84, + 169, + 176, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "student", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 7, + "column": 38, + "line": 5, }, "start": Object { - "column": 1, - "line": 7, + "column": 37, + "line": 5, }, }, "range": Array [ - 84, - 85, + 176, + 177, ], "type": "Punctuator", - "value": ";", + "value": ":", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-type-parameter.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 17, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 46, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 39, + "line": 5, }, }, "range": Array [ - 0, - 17, + 178, + 185, ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 10, - 11, - ], - "type": "Identifier", - }, - "range": Array [ - 10, - 11, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 9, - 12, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "boolean", }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 48, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 47, + "line": 5, }, }, "range": Array [ - 0, - 5, + 186, + 187, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 54, + "line": 5, }, "start": Object { - "column": 6, - "line": 1, + "column": 49, + "line": 5, }, }, "range": Array [ - 6, - 9, + 188, + 193, ], - "type": "Identifier", - "value": "Foo", + "type": "Boolean", + "value": "false", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 55, + "line": 5, }, "start": Object { - "column": 9, - "line": 1, + "column": 54, + "line": 5, }, }, "range": Array [ - 9, - 10, + 193, + 194, ], "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, - ], - "type": "Identifier", - "value": "T", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 57, + "line": 5, }, "start": Object { - "column": 11, - "line": 1, + "column": 56, + "line": 5, }, }, "range": Array [ - 11, - 12, + 195, + 196, ], "type": "Punctuator", - "value": ">", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 58, + "line": 5, }, "start": Object { - "column": 13, - "line": 1, + "column": 57, + "line": 5, }, }, "range": Array [ - 13, - 14, + 196, + 197, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { "column": 0, - "line": 3, + "line": 6, }, }, "range": Array [ - 16, - 17, + 198, + 199, ], "type": "Punctuator", "value": "}", @@ -32149,25 +32135,281 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-type-parameter-default.src 1`] = ` +exports[`typescript fixtures/basics/class-with-readonly-parameter-properties.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [], + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 107, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 51, + "line": 3, + }, + }, + "range": Array [ + 105, + 107, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "firstName", + "range": Array [ + 35, + 52, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 52, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 26, + 52, + ], + "readonly": true, + "type": "TSParameterProperty", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "name": "lastName", + "range": Array [ + 77, + 93, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "range": Array [ + 85, + 93, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 87, + 93, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 77, + 103, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 3, + }, + }, + "range": Array [ + 96, + 103, + ], + "raw": "'Smith'", + "type": "Literal", + "value": "Smith", + }, + "type": "AssignmentPattern", + }, + "range": Array [ + 68, + 103, + ], + "readonly": true, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 25, + 107, + ], + "type": "FunctionExpression", + }, + }, + ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { - "column": 19, + "column": 10, "line": 1, }, }, "range": Array [ - 19, - 23, + 10, + 109, ], "type": "ClassBody", }, @@ -32192,7 +32434,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 4, }, "start": Object { "column": 0, @@ -32201,104 +32443,15 @@ Object { }, "range": Array [ 0, - 23, + 109, ], "superClass": null, "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "params": Array [ - Object { - "default": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 17, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 10, - 11, - ], - "type": "Identifier", - }, - "range": Array [ - 10, - 17, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 9, - 18, - ], - "type": "TSTypeParameterDeclaration", - }, }, ], "loc": Object { "end": Object { - "column": 0, + "column": 1, "line": 4, }, "start": Object { @@ -32308,7 +32461,7 @@ Object { }, "range": Array [ 0, - 24, + 109, ], "sourceType": "script", "tokens": Array [ @@ -32351,366 +32504,287 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 1, }, "start": Object { - "column": 9, + "column": 10, "line": 1, }, }, "range": Array [ - 9, 10, + 11, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 10, - 11, + 14, + 25, ], "type": "Identifier", - "value": "T", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 12, - 13, + 25, + 26, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { "column": 14, - "line": 1, + "line": 2, }, }, "range": Array [ - 14, - 17, + 26, + 34, ], "type": "Identifier", - "value": "Bar", + "value": "readonly", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 32, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 23, + "line": 2, }, }, "range": Array [ - 17, - 18, + 35, + 44, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "firstName", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 33, + "line": 2, }, "start": Object { - "column": 19, - "line": 1, + "column": 32, + "line": 2, }, }, "range": Array [ - 19, - 20, + 44, + 45, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 40, + "line": 2, }, "start": Object { - "column": 0, - "line": 3, + "column": 34, + "line": 2, }, }, "range": Array [ - 22, - 23, + 46, + 52, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "string", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-type-parameter-underscore.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 15, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 41, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 40, + "line": 2, }, }, "range": Array [ - 0, - 15, + 52, + 53, ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "__P", - "range": Array [ - 8, - 11, - ], - "type": "Identifier", - }, - "range": Array [ - 8, - 11, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 7, - 12, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ",", }, - }, - "range": Array [ - 0, - 16, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 22, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 14, + "line": 3, }, }, "range": Array [ - 0, - 5, + 68, + 76, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "readonly", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 31, + "line": 3, }, "start": Object { - "column": 6, - "line": 1, + "column": 23, + "line": 3, }, }, "range": Array [ - 6, - 7, + 77, + 85, ], "type": "Identifier", - "value": "A", + "value": "lastName", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 32, + "line": 3, }, "start": Object { - "column": 7, - "line": 1, + "column": 31, + "line": 3, }, }, "range": Array [ - 7, - 8, + 85, + 86, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 39, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, + "column": 33, + "line": 3, }, }, "range": Array [ - 8, - 11, + 87, + 93, ], "type": "Identifier", - "value": "__P", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 41, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 40, + "line": 3, }, }, "range": Array [ - 11, - 12, + 94, + 95, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 49, + "line": 3, }, "start": Object { - "column": 13, - "line": 1, + "column": 42, + "line": 3, }, }, "range": Array [ - 13, - 14, + 96, + 103, + ], + "type": "String", + "value": "'Smith'", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 49, + "line": 3, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 3, + }, + "start": Object { + "column": 51, + "line": 3, + }, + }, + "range": Array [ + 105, + 106, ], "type": "Punctuator", "value": "{", @@ -32718,17 +32792,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 53, + "line": 3, }, "start": Object { - "column": 14, - "line": 1, + "column": 52, + "line": 3, }, }, "range": Array [ - 14, - 15, + 106, + 107, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 108, + 109, ], "type": "Punctuator", "value": "}", @@ -32738,1240 +32830,1498 @@ Object { } `; -exports[`typescript fixtures/basics/const-assertions.src 1`] = ` +exports[`typescript fixtures/basics/class-with-readonly-property.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "public", + "computed": false, + "declare": false, + "key": Object { "loc": Object { "end": Object { - "column": 10, + "column": 23, "line": 2, }, "start": Object { - "column": 8, + "column": 20, "line": 2, }, }, + "name": "foo", "range": Array [ - 21, - 23, + 32, + 35, ], - "raw": "10", - "type": "Literal", - "value": 10, + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 19, + "column": 35, "line": 2, }, "start": Object { - "column": 8, + "column": 4, "line": 2, }, }, "range": Array [ - 21, - 32, + 16, + 47, ], - "type": "TSAsExpression", - "typeAnnotation": Object { + "readonly": true, + "static": false, + "type": "ClassProperty", + "value": Object { "loc": Object { "end": Object { - "column": 19, + "column": 34, "line": 2, }, "start": Object { - "column": 14, + "column": 26, "line": 2, }, }, "range": Array [ - 27, - 32, + 38, + 46, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "name": "const", - "range": Array [ - 27, - 32, - ], - "type": "Identifier", - }, + "raw": "'string'", + "type": "Literal", + "value": "string", }, }, - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "range": Array [ - 17, - 32, - ], - "type": "VariableDeclarator", + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 49, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, ], - "kind": "let", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 31, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { "loc": Object { "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { "column": 20, "line": 2, }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, "start": Object { - "column": 0, + "column": 24, "line": 2, }, }, "range": Array [ - 13, - 33, + 36, + 37, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": "=", }, Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "name": "y", - "range": Array [ - 67, - 68, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 5, - }, - "start": Object { - "column": 9, - "line": 5, - }, - }, - "range": Array [ - 72, - 74, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 5, - }, - "start": Object { - "column": 13, - "line": 5, - }, - }, - "range": Array [ - 76, - 78, - ], - "raw": "20", - "type": "Literal", - "value": 20, - }, - ], + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "String", + "value": "'string'", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-static-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 15, + "line": 2, }, "start": Object { - "column": 8, - "line": 5, + "column": 4, + "line": 2, }, }, + "name": "constructor", "range": Array [ - 71, - 79, + 16, + 27, ], - "type": "ArrayExpression", + "type": "Identifier", }, + "kind": "constructor", "loc": Object { "end": Object { - "column": 25, - "line": 5, + "column": 5, + "line": 4, }, "start": Object { - "column": 8, - "line": 5, + "column": 4, + "line": 2, }, }, "range": Array [ - 71, - 88, + 16, + 54, ], - "type": "TSAsExpression", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 5, - }, - "start": Object { - "column": 20, - "line": 5, - }, - }, - "range": Array [ - 83, - 88, - ], - "type": "TSTypeReference", - "typeName": Object { + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 25, - "line": 5, + "column": 5, + "line": 4, }, "start": Object { - "column": 20, - "line": 5, + "column": 34, + "line": 2, }, }, - "name": "const", "range": Array [ - 83, - 88, + 46, + 54, ], - "type": "Identifier", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "range": Array [ - 67, - 88, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 26, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, - }, - }, - "range": Array [ - 63, - 89, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, + "type": "BlockStatement", }, - }, - "name": "z", - "range": Array [ - 132, - 133, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 25, - "line": 8, + "column": 5, + "line": 4, }, "start": Object { - "column": 8, - "line": 8, + "column": 15, + "line": 2, }, }, - "properties": Array [ + "params": Array [ Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 8, - }, - "start": Object { - "column": 10, - "line": 8, - }, - }, - "name": "text", - "range": Array [ - 138, - 142, - ], - "type": "Identifier", - }, - "kind": "init", "loc": Object { "end": Object { - "column": 23, - "line": 8, + "column": 32, + "line": 2, }, "start": Object { - "column": 10, - "line": 8, + "column": 16, + "line": 2, }, }, - "method": false, - "range": Array [ - 138, - 151, - ], - "shorthand": false, - "type": "Property", - "value": Object { + "parameter": Object { "loc": Object { "end": Object { - "column": 23, - "line": 8, + "column": 32, + "line": 2, }, "start": Object { - "column": 16, - "line": 8, + "column": 23, + "line": 2, }, }, + "name": "a", "range": Array [ - 144, - 151, + 35, + 44, ], - "raw": "\\"hello\\"", - "type": "Literal", - "value": "hello", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TSStringKeyword", + }, + }, }, + "range": Array [ + 28, + 44, + ], + "static": true, + "type": "TSParameterProperty", }, ], "range": Array [ - 136, - 153, - ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 34, - "line": 8, - }, - "start": Object { - "column": 8, - "line": 8, - }, - }, - "range": Array [ - 136, - 162, - ], - "type": "TSAsExpression", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 8, - }, - "start": Object { - "column": 29, - "line": 8, - }, - }, - "range": Array [ - 157, - 162, + 27, + 54, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 8, - }, - "start": Object { - "column": 29, - "line": 8, - }, - }, - "name": "const", - "range": Array [ - 157, - 162, - ], - "type": "Identifier", - }, + "type": "FunctionExpression", }, }, - "loc": Object { - "end": Object { - "column": 34, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, }, - "range": Array [ - 132, - 162, - ], - "type": "VariableDeclarator", + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 56, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 56, ], - "kind": "let", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { "loc": Object { "end": Object { - "column": 35, - "line": 8, + "column": 5, + "line": 1, }, "start": Object { "column": 0, - "line": 8, + "line": 1, }, }, "range": Array [ - 128, - 163, + 0, + 5, ], - "type": "VariableDeclaration", + "type": "Keyword", + "value": "class", }, Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 11, - }, - "start": Object { - "column": 4, - "line": 11, - }, - }, - "name": "x", - "range": Array [ - 182, - 183, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 11, - }, - "start": Object { - "column": 15, - "line": 11, - }, - }, - "range": Array [ - 193, - 195, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 11, - }, - "start": Object { - "column": 8, - "line": 11, - }, - }, - "range": Array [ - 186, - 195, - ], - "type": "TSTypeAssertion", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 11, - }, - "start": Object { - "column": 9, - "line": 11, - }, - }, - "range": Array [ - 187, - 192, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 11, - }, - "start": Object { - "column": 9, - "line": 11, - }, - }, - "name": "const", - "range": Array [ - 187, - 192, - ], - "type": "Identifier", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 11, - }, - "start": Object { - "column": 4, - "line": 11, - }, - }, - "range": Array [ - 182, - 195, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, + }, + "range": Array [ + 6, + 9, ], - "kind": "let", + "type": "Identifier", + "value": "Foo", + }, + Object { "loc": Object { "end": Object { - "column": 18, - "line": 11, + "column": 11, + "line": 1, }, "start": Object { - "column": 0, - "line": 11, + "column": 10, + "line": 1, }, }, "range": Array [ - 178, - 196, + 10, + 11, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": "{", }, Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 14, - }, - "start": Object { - "column": 4, - "line": 14, - }, - }, - "name": "y", - "range": Array [ - 230, - 231, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 14, - }, - "start": Object { - "column": 16, - "line": 14, - }, - }, - "range": Array [ - 242, - 244, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 14, - }, - "start": Object { - "column": 20, - "line": 14, - }, - }, - "range": Array [ - 246, - 248, - ], - "raw": "20", - "type": "Literal", - "value": 20, - }, - ], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-two-methods-computed-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 23, - "line": 14, + "column": 15, + "line": 2, }, "start": Object { - "column": 15, - "line": 14, + "column": 2, + "line": 2, }, }, "range": Array [ - 241, - 249, + 12, + 25, ], - "type": "ArrayExpression", + "raw": "\\"constructor\\"", + "type": "Literal", + "value": "constructor", }, + "kind": "constructor", "loc": Object { "end": Object { - "column": 23, - "line": 14, + "column": 3, + "line": 3, }, "start": Object { - "column": 8, - "line": 14, + "column": 2, + "line": 2, }, }, "range": Array [ - 234, - 249, + 12, + 44, ], - "type": "TSTypeAssertion", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 14, - }, - "start": Object { - "column": 9, - "line": 14, - }, - }, - "range": Array [ - 235, - 240, - ], - "type": "TSTypeReference", - "typeName": Object { + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 14, - "line": 14, + "column": 3, + "line": 3, }, "start": Object { - "column": 9, - "line": 14, + "column": 29, + "line": 2, }, }, - "name": "const", "range": Array [ - 235, - 240, + 39, + 44, ], - "type": "Identifier", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 14, - }, - "start": Object { - "column": 4, - "line": 14, - }, - }, - "range": Array [ - 230, - 249, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 24, - "line": 14, - }, - "start": Object { - "column": 0, - "line": 14, - }, - }, - "range": Array [ - 226, - 250, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 17, - }, - "start": Object { - "column": 4, - "line": 17, + "type": "BlockStatement", }, - }, - "name": "z", - "range": Array [ - 293, - 294, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 32, - "line": 17, + "column": 3, + "line": 3, }, "start": Object { "column": 15, - "line": 17, + "line": 2, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 17, - }, - "start": Object { - "column": 17, - "line": 17, - }, - }, - "name": "text", - "range": Array [ - 306, - 310, - ], - "type": "Identifier", + "params": Array [], + "range": Array [ + 25, + 44, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, }, - "kind": "init", + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 30, - "line": 17, + "column": 28, + "line": 2, }, "start": Object { - "column": 17, - "line": 17, + "column": 22, + "line": 2, }, }, - "method": false, "range": Array [ - 306, - 319, + 32, + 38, ], - "shorthand": false, - "type": "Property", - "value": Object { + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 30, - "line": 17, + "column": 17, + "line": 2, }, "start": Object { - "column": 23, - "line": 17, + "column": 16, + "line": 2, }, }, + "name": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, "range": Array [ - 312, - 319, + 26, + 27, ], - "raw": "\\"hello\\"", - "type": "Literal", - "value": "hello", + "type": "TSTypeParameter", }, + ], + "range": Array [ + 25, + 28, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, }, - ], + "start": Object { + "column": 3, + "line": 5, + }, + }, "range": Array [ - 304, - 321, + 49, + 62, ], - "type": "ObjectExpression", + "raw": "\\"constructor\\"", + "type": "Literal", + "value": "constructor", }, + "kind": "method", "loc": Object { "end": Object { - "column": 32, - "line": 17, + "column": 3, + "line": 6, }, "start": Object { - "column": 8, - "line": 17, + "column": 2, + "line": 5, }, }, "range": Array [ - 297, - 321, + 48, + 82, ], - "type": "TSTypeAssertion", - "typeAnnotation": Object { + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 31, + "line": 5, + }, + }, + "range": Array [ + 77, + 82, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 14, - "line": 17, + "column": 3, + "line": 6, }, "start": Object { - "column": 9, - "line": 17, + "column": 17, + "line": 5, }, }, + "params": Array [], "range": Array [ - 298, - 303, + 63, + 82, ], - "type": "TSTypeReference", - "typeName": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 14, - "line": 17, + "column": 30, + "line": 5, }, "start": Object { - "column": 9, - "line": 17, + "column": 22, + "line": 5, }, }, - "name": "const", "range": Array [ - 298, - 303, + 68, + 76, ], - "type": "Identifier", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 70, + 76, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "name": "T", + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + }, + "range": Array [ + 64, + 65, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 63, + 66, + ], + "type": "TSTypeParameterDeclaration", }, }, }, - "loc": Object { - "end": Object { - "column": 32, - "line": 17, - }, - "start": Object { - "column": 4, - "line": 17, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 1, }, - "range": Array [ - 293, - 321, - ], - "type": "VariableDeclarator", }, - ], - "kind": "let", + "range": Array [ + 8, + 84, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 33, - "line": 17, + "column": 1, + "line": 7, }, "start": Object { "column": 0, - "line": 17, + "line": 1, }, }, "range": Array [ - 289, - 322, + 0, + 84, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "EmptyStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 18, + "line": 8, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, "range": Array [ - 13, - 323, + 0, + 86, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, "range": Array [ - 13, - 16, + 0, + 5, ], "type": "Keyword", - "value": "let", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 7, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 17, - 18, + 6, + 7, ], "type": "Identifier", - "value": "x", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, "line": 2, }, "start": Object { - "column": 6, + "column": 2, "line": 2, }, }, "range": Array [ - 19, - 20, + 12, + 25, ], - "type": "Punctuator", - "value": "=", + "type": "String", + "value": "\\"constructor\\"", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 2, }, "start": Object { - "column": 8, + "column": 15, "line": 2, }, }, "range": Array [ - 21, - 23, + 25, + 26, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 17, "line": 2, }, "start": Object { - "column": 11, + "column": 16, "line": 2, }, }, "range": Array [ - 24, 26, + 27, ], "type": "Identifier", - "value": "as", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 18, "line": 2, }, "start": Object { - "column": 14, + "column": 17, "line": 2, }, }, "range": Array [ 27, - 32, + 28, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 19, "line": 2, }, "start": Object { - "column": 19, + "column": 18, "line": 2, }, }, "range": Array [ - 32, - 33, + 28, + 29, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 20, + "line": 2, }, "start": Object { - "column": 0, - "line": 5, + "column": 19, + "line": 2, }, }, "range": Array [ - 63, - 66, + 29, + 30, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 21, + "line": 2, }, "start": Object { - "column": 4, - "line": 5, + "column": 20, + "line": 2, }, }, "range": Array [ - 67, - 68, + 30, + 31, ], - "type": "Identifier", - "value": "y", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 28, + "line": 2, }, "start": Object { - "column": 6, - "line": 5, + "column": 22, + "line": 2, }, }, "range": Array [ - 69, - 70, + 32, + 38, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 30, + "line": 2, }, "start": Object { - "column": 8, - "line": 5, + "column": 29, + "line": 2, }, }, "range": Array [ - 71, - 72, + 39, + 40, ], "type": "Punctuator", - "value": "[", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 5, + "column": 3, + "line": 3, }, "start": Object { - "column": 9, - "line": 5, + "column": 2, + "line": 3, }, }, "range": Array [ - 72, - 74, + 43, + 44, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 3, "line": 5, }, "start": Object { - "column": 11, + "column": 2, "line": 5, }, }, "range": Array [ - 74, - 75, + 48, + 49, ], "type": "Punctuator", - "value": ",", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 5, }, "start": Object { - "column": 13, + "column": 3, "line": 5, }, }, "range": Array [ - 76, - 78, + 49, + 62, ], - "type": "Numeric", - "value": "20", + "type": "String", + "value": "\\"constructor\\"", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 5, }, "start": Object { - "column": 15, + "column": 16, "line": 5, }, }, "range": Array [ - 78, - 79, + 62, + 63, ], "type": "Punctuator", "value": "]", @@ -33979,7 +34329,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 18, "line": 5, }, "start": Object { @@ -33988,188 +34338,170 @@ Object { }, }, "range": Array [ - 80, - 82, + 63, + 64, ], - "type": "Identifier", - "value": "as", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 19, "line": 5, }, "start": Object { - "column": 20, + "column": 18, "line": 5, }, }, "range": Array [ - 83, - 88, + 64, + 65, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 20, "line": 5, }, "start": Object { - "column": 25, + "column": 19, "line": 5, }, }, "range": Array [ - 88, - 89, + 65, + 66, ], "type": "Punctuator", - "value": ";", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 8, + "column": 21, + "line": 5, }, "start": Object { - "column": 0, - "line": 8, + "column": 20, + "line": 5, }, }, "range": Array [ - 128, - 131, + 66, + 67, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 8, + "column": 22, + "line": 5, }, "start": Object { - "column": 4, - "line": 8, + "column": 21, + "line": 5, }, }, "range": Array [ - 132, - 133, + 67, + 68, ], - "type": "Identifier", - "value": "z", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 8, + "column": 23, + "line": 5, }, "start": Object { - "column": 6, - "line": 8, - }, - }, - "range": Array [ - 134, - 135, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 8, - }, - "start": Object { - "column": 8, - "line": 8, + "column": 22, + "line": 5, }, }, "range": Array [ - 136, - 137, + 68, + 69, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 8, + "column": 30, + "line": 5, }, "start": Object { - "column": 10, - "line": 8, + "column": 24, + "line": 5, }, }, "range": Array [ - 138, - 142, + 70, + 76, ], "type": "Identifier", - "value": "text", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 8, + "column": 32, + "line": 5, }, "start": Object { - "column": 14, - "line": 8, + "column": 31, + "line": 5, }, }, "range": Array [ - 142, - 143, + 77, + 78, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 8, + "column": 3, + "line": 6, }, "start": Object { - "column": 16, - "line": 8, + "column": 2, + "line": 6, }, }, "range": Array [ - 144, - 151, + 81, + 82, ], - "type": "String", - "value": "\\"hello\\"", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 8, + "column": 1, + "line": 7, }, "start": Object { - "column": 24, - "line": 8, + "column": 0, + "line": 7, }, }, "range": Array [ - 152, - 153, + 83, + 84, ], "type": "Punctuator", "value": "}", @@ -34177,125 +34509,204 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, - "line": 8, + "column": 2, + "line": 7, }, "start": Object { - "column": 26, - "line": 8, + "column": 1, + "line": 7, }, }, "range": Array [ - 154, - 156, + 84, + 85, ], - "type": "Identifier", - "value": "as", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-type-parameter.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 8, - }, - "start": Object { - "column": 29, - "line": 8, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 1, + }, }, + "range": Array [ + 13, + 17, + ], + "type": "ClassBody", }, - "range": Array [ - 157, - 162, - ], - "type": "Keyword", - "value": "const", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 8, - }, - "start": Object { - "column": 34, - "line": 8, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", }, - "range": Array [ - 162, - 163, - ], - "type": "Punctuator", - "value": ";", - }, - Object { "loc": Object { "end": Object { - "column": 3, - "line": 11, + "column": 1, + "line": 3, }, "start": Object { "column": 0, - "line": 11, + "line": 1, }, }, "range": Array [ - 178, - 181, + 0, + 17, ], - "type": "Keyword", - "value": "let", + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 10, + 11, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { "column": 5, - "line": 11, + "line": 1, }, "start": Object { - "column": 4, - "line": 11, + "column": 0, + "line": 1, }, }, "range": Array [ - 182, - 183, + 0, + 5, ], - "type": "Identifier", - "value": "x", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 11, + "column": 9, + "line": 1, }, "start": Object { "column": 6, - "line": 11, + "line": 1, }, }, "range": Array [ - 184, - 185, + 6, + 9, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 11, + "column": 10, + "line": 1, }, "start": Object { - "column": 8, - "line": 11, + "column": 9, + "line": 1, }, }, "range": Array [ - 186, - 187, + 9, + 10, ], "type": "Punctuator", "value": "<", @@ -34303,35 +34714,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 11, + "column": 11, + "line": 1, }, "start": Object { - "column": 9, - "line": 11, + "column": 10, + "line": 1, }, }, "range": Array [ - 187, - 192, + 10, + 11, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 11, + "column": 12, + "line": 1, }, "start": Object { - "column": 14, - "line": 11, + "column": 11, + "line": 1, }, }, "range": Array [ - 192, - 193, + 11, + 12, ], "type": "Punctuator", "value": ">", @@ -34339,107 +34750,257 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, - "line": 11, + "column": 14, + "line": 1, }, "start": Object { - "column": 15, - "line": 11, + "column": 13, + "line": 1, }, }, "range": Array [ - 193, - 195, + 13, + 14, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 11, + "column": 1, + "line": 3, }, "start": Object { - "column": 17, - "line": 11, + "column": 0, + "line": 3, }, }, "range": Array [ - 195, - 196, + 16, + 17, ], "type": "Punctuator", - "value": ";", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-type-parameter-default.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 3, - "line": 14, + "column": 1, + "line": 3, }, "start": Object { "column": 0, - "line": 14, + "line": 1, }, }, "range": Array [ - 226, - 229, + 0, + 23, ], - "type": "Keyword", - "value": "let", + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "default": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 10, + 17, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 9, + 18, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { "column": 5, - "line": 14, + "line": 1, }, "start": Object { - "column": 4, - "line": 14, + "column": 0, + "line": 1, }, }, "range": Array [ - 230, - 231, + 0, + 5, ], - "type": "Identifier", - "value": "y", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 14, + "column": 9, + "line": 1, }, "start": Object { "column": 6, - "line": 14, + "line": 1, }, }, "range": Array [ - 232, - 233, + 6, + 9, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 14, + "column": 10, + "line": 1, }, "start": Object { - "column": 8, - "line": 14, + "column": 9, + "line": 1, }, }, "range": Array [ - 234, - 235, + 9, + 10, ], "type": "Punctuator", "value": "<", @@ -34447,215 +35008,294 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 14, + "column": 11, + "line": 1, }, "start": Object { - "column": 9, - "line": 14, + "column": 10, + "line": 1, }, }, "range": Array [ - 235, - 240, + 10, + 11, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 14, + "column": 13, + "line": 1, }, "start": Object { - "column": 14, - "line": 14, + "column": 12, + "line": 1, }, }, "range": Array [ - 240, - 241, + 12, + 13, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 14, + "column": 17, + "line": 1, }, "start": Object { - "column": 15, - "line": 14, + "column": 14, + "line": 1, }, }, "range": Array [ - 241, - 242, + 14, + 17, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "Bar", }, Object { "loc": Object { "end": Object { "column": 18, - "line": 14, - }, - "start": Object { - "column": 16, - "line": 14, - }, - }, - "range": Array [ - 242, - 244, - ], - "type": "Numeric", - "value": "10", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 14, + "line": 1, }, "start": Object { - "column": 18, - "line": 14, + "column": 17, + "line": 1, }, }, "range": Array [ - 244, - 245, + 17, + 18, ], "type": "Punctuator", - "value": ",", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 14, + "column": 20, + "line": 1, }, "start": Object { - "column": 20, - "line": 14, + "column": 19, + "line": 1, }, }, "range": Array [ - 246, - 248, + 19, + 20, ], - "type": "Numeric", - "value": "20", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 14, + "column": 1, + "line": 3, }, "start": Object { - "column": 22, - "line": 14, + "column": 0, + "line": 3, }, }, "range": Array [ - 248, - 249, + 22, + 23, ], "type": "Punctuator", - "value": "]", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-type-parameter-underscore.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 14, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, }, - "start": Object { - "column": 23, - "line": 14, + "range": Array [ + 13, + 15, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", }, - "range": Array [ - 249, - 250, - ], - "type": "Punctuator", - "value": ";", - }, - Object { "loc": Object { "end": Object { - "column": 3, - "line": 17, + "column": 15, + "line": 1, }, "start": Object { "column": 0, - "line": 17, + "line": 1, }, }, "range": Array [ - 289, - 292, + 0, + 15, ], - "type": "Keyword", - "value": "let", + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "__P", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 11, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 7, + 12, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { "column": 5, - "line": 17, + "line": 1, }, "start": Object { - "column": 4, - "line": 17, + "column": 0, + "line": 1, }, }, "range": Array [ - 293, - 294, + 0, + 5, ], - "type": "Identifier", - "value": "z", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { "column": 7, - "line": 17, + "line": 1, }, "start": Object { "column": 6, - "line": 17, + "line": 1, }, }, "range": Array [ - 295, - 296, + 6, + 7, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 17, + "column": 8, + "line": 1, }, "start": Object { - "column": 8, - "line": 17, + "column": 7, + "line": 1, }, }, "range": Array [ - 297, - 298, + 7, + 8, ], "type": "Punctuator", "value": "<", @@ -34663,35 +35303,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 17, + "column": 11, + "line": 1, }, "start": Object { - "column": 9, - "line": 17, + "column": 8, + "line": 1, }, }, "range": Array [ - 298, - 303, + 8, + 11, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "__P", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 17, + "column": 12, + "line": 1, }, "start": Object { - "column": 14, - "line": 17, + "column": 11, + "line": 1, }, }, "range": Array [ - 303, - 304, + 11, + 12, ], "type": "Punctuator", "value": ">", @@ -34699,17 +35339,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 17, + "column": 14, + "line": 1, }, "start": Object { - "column": 15, - "line": 17, + "column": 13, + "line": 1, }, }, "range": Array [ - 304, - 305, + 13, + 14, ], "type": "Punctuator", "value": "{", @@ -34717,137 +35357,36 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 17, - }, - "start": Object { - "column": 17, - "line": 17, - }, - }, - "range": Array [ - 306, - 310, - ], - "type": "Identifier", - "value": "text", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 17, - }, - "start": Object { - "column": 21, - "line": 17, - }, - }, - "range": Array [ - 310, - 311, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 17, - }, - "start": Object { - "column": 23, - "line": 17, - }, - }, - "range": Array [ - 312, - 319, - ], - "type": "String", - "value": "\\"hello\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 17, + "column": 15, + "line": 1, }, "start": Object { - "column": 31, - "line": 17, + "column": 14, + "line": 1, }, }, "range": Array [ - 320, - 321, + 14, + 15, ], "type": "Punctuator", "value": "}", }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 17, - }, - "start": Object { - "column": 32, - "line": 17, - }, - }, - "range": Array [ - 321, - 322, - ], - "type": "Punctuator", - "value": ";", - }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/const-enum.src 1`] = ` +exports[`typescript fixtures/basics/const-assertions.src 1`] = ` Object { "body": Array [ Object { - "const": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 11, - 14, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "members": Array [ + "declarations": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 2, }, "start": Object { @@ -34855,35 +35394,87 @@ Object { "line": 2, }, }, - "name": "foo", + "name": "x", "range": Array [ - 21, - 24, + 17, + 18, ], "type": "Identifier", }, - "initializer": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, }, - "start": Object { - "column": 10, + "range": Array [ + 21, + 23, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 8, "line": 2, }, }, "range": Array [ - 27, - 28, + 21, + 32, ], - "raw": "1", - "type": "Literal", - "value": 1, + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "const", + "range": Array [ + 27, + 32, + ], + "type": "Identifier", + }, + }, }, "loc": Object { "end": Object { - "column": 11, + "column": 19, "line": 2, }, "start": Object { @@ -34892,146 +35483,890 @@ Object { }, }, "range": Array [ - 21, - 28, + 17, + 32, ], - "type": "TSEnumMember", + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, }, + }, + "range": Array [ + 13, + 33, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 5, + "line": 5, }, "start": Object { "column": 4, - "line": 3, + "line": 5, }, }, - "name": "bar", + "name": "y", "range": Array [ - 34, - 37, + 67, + 68, ], "type": "Identifier", }, + "init": Object { + "expression": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 72, + 74, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 76, + 78, + ], + "raw": "20", + "type": "Literal", + "value": 20, + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 71, + 79, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 71, + 88, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 83, + 88, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "name": "const", + "range": Array [ + 83, + 88, + ], + "type": "Identifier", + }, + }, + }, "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 25, + "line": 5, }, "start": Object { "column": 4, - "line": 3, + "line": 5, }, }, "range": Array [ - 34, - 37, + 67, + 88, ], - "type": "TSEnumMember", + "type": "VariableDeclarator", }, ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, "range": Array [ - 0, - 39, + 63, + 89, ], - "type": "TSEnumDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, + "type": "VariableDeclaration", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": "z", + "range": Array [ + 132, + 133, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "name": "text", + "range": Array [ + 138, + 142, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "method": false, + "range": Array [ + 138, + 151, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 144, + 151, + ], + "raw": "\\"hello\\"", + "type": "Literal", + "value": "hello", + }, + }, + ], + "range": Array [ + 136, + 153, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 136, + 162, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 29, + "line": 8, + }, + }, + "range": Array [ + 157, + 162, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 29, + "line": 8, + }, + }, + "name": "const", + "range": Array [ + 157, + 162, + ], + "type": "Identifier", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 132, + 162, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 35, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 128, + 163, + ], + "type": "VariableDeclaration", }, - }, - "range": Array [ - 0, - 39, - ], - "sourceType": "script", - "tokens": Array [ Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "name": "x", + "range": Array [ + 182, + 183, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 193, + 195, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 186, + 195, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 187, + 192, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "name": "const", + "range": Array [ + 187, + 192, + ], + "type": "Identifier", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 182, + 195, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 18, + "line": 11, }, "start": Object { "column": 0, - "line": 1, + "line": 11, }, }, "range": Array [ - 0, - 5, + 178, + 196, ], - "type": "Keyword", - "value": "const", + "type": "VariableDeclaration", }, Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "name": "y", + "range": Array [ + 230, + 231, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 14, + }, + "start": Object { + "column": 16, + "line": 14, + }, + }, + "range": Array [ + 242, + 244, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 14, + }, + "start": Object { + "column": 20, + "line": 14, + }, + }, + "range": Array [ + 246, + 248, + ], + "raw": "20", + "type": "Literal", + "value": 20, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 15, + "line": 14, + }, + }, + "range": Array [ + 241, + 249, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 8, + "line": 14, + }, + }, + "range": Array [ + 234, + 249, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 14, + }, + "start": Object { + "column": 9, + "line": 14, + }, + }, + "range": Array [ + 235, + 240, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 14, + }, + "start": Object { + "column": 9, + "line": 14, + }, + }, + "name": "const", + "range": Array [ + 235, + 240, + ], + "type": "Identifier", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 230, + 249, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 24, + "line": 14, }, "start": Object { - "column": 6, - "line": 1, + "column": 0, + "line": 14, }, }, "range": Array [ - 6, - 10, + 226, + 250, ], - "type": "Keyword", - "value": "enum", + "type": "VariableDeclaration", }, Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 17, + }, + "start": Object { + "column": 4, + "line": 17, + }, + }, + "name": "z", + "range": Array [ + 293, + 294, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 17, + }, + "start": Object { + "column": 15, + "line": 17, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 17, + }, + "start": Object { + "column": 17, + "line": 17, + }, + }, + "name": "text", + "range": Array [ + 306, + 310, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 30, + "line": 17, + }, + "start": Object { + "column": 17, + "line": 17, + }, + }, + "method": false, + "range": Array [ + 306, + 319, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 17, + }, + "start": Object { + "column": 23, + "line": 17, + }, + }, + "range": Array [ + 312, + 319, + ], + "raw": "\\"hello\\"", + "type": "Literal", + "value": "hello", + }, + }, + ], + "range": Array [ + 304, + 321, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "range": Array [ + 297, + 321, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 17, + }, + "start": Object { + "column": 9, + "line": 17, + }, + }, + "range": Array [ + 298, + 303, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 17, + }, + "start": Object { + "column": 9, + "line": 17, + }, + }, + "name": "const", + "range": Array [ + 298, + 303, + ], + "type": "Identifier", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 17, + }, + "start": Object { + "column": 4, + "line": 17, + }, + }, + "range": Array [ + 293, + 321, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 33, + "line": 17, }, "start": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 17, }, }, "range": Array [ - 11, - 14, + 289, + 322, ], - "type": "Identifier", - "value": "Foo", + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 18, + }, + "start": Object { + "column": 0, + "line": 2, }, + }, + "range": Array [ + 13, + 323, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 0, + "line": 2, }, }, "range": Array [ - 15, + 13, 16, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 2, }, "start": Object { @@ -35040,26 +36375,26 @@ Object { }, }, "range": Array [ - 21, - 24, + 17, + 18, ], "type": "Identifier", - "value": "foo", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 2, }, "start": Object { - "column": 8, + "column": 6, "line": 2, }, }, "range": Array [ - 25, - 26, + 19, + 20, ], "type": "Punctuator", "value": "=", @@ -35067,25 +36402,25 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 2, }, "start": Object { - "column": 10, + "column": 8, "line": 2, }, }, "range": Array [ - 27, - 28, + 21, + 23, ], "type": "Numeric", - "value": "1", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 2, }, "start": Object { @@ -35094,1048 +36429,638 @@ Object { }, }, "range": Array [ - 28, - 29, + 24, + 26, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "as", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 19, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 14, + "line": 2, }, }, "range": Array [ - 34, - 37, + 27, + 32, ], - "type": "Identifier", - "value": "bar", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 20, + "line": 2, }, "start": Object { - "column": 0, - "line": 4, + "column": 19, + "line": 2, }, }, "range": Array [ - 38, - 39, + 32, + 33, ], "type": "Punctuator", - "value": "}", + "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/declare-class-with-optional-method.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "bar", - "optional": true, - "range": Array [ - 24, - 27, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 24, - 36, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 28, - 36, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 30, - 35, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 32, - 35, - ], - "type": "TSAnyKeyword", - }, - }, - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, }, - "range": Array [ - 18, - 38, - ], - "type": "ClassBody", - }, - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, + "start": Object { + "column": 0, + "line": 5, }, - "name": "Foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", }, + "range": Array [ + 63, + 66, + ], + "type": "Keyword", + "value": "let", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 5, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 5, }, }, "range": Array [ - 0, - 38, + 67, + 68, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "y", }, - }, - "range": Array [ - 0, - 38, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { "column": 7, - "line": 1, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 6, + "line": 5, }, }, "range": Array [ - 0, - 7, + 69, + 70, ], - "type": "Identifier", - "value": "declare", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { "column": 8, - "line": 1, + "line": 5, }, }, "range": Array [ - 8, - 13, + 71, + 72, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 11, + "line": 5, }, "start": Object { - "column": 14, - "line": 1, + "column": 9, + "line": 5, }, }, "range": Array [ - 14, - 17, + 72, + 74, ], - "type": "Identifier", - "value": "Foo", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 12, + "line": 5, }, "start": Object { - "column": 18, - "line": 1, + "column": 11, + "line": 5, }, }, "range": Array [ - 18, - 19, + 74, + 75, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 15, + "line": 5, }, "start": Object { - "column": 4, - "line": 2, + "column": 13, + "line": 5, }, }, "range": Array [ - 24, - 27, + 76, + 78, ], - "type": "Identifier", - "value": "bar", + "type": "Numeric", + "value": "20", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 16, + "line": 5, }, "start": Object { - "column": 7, - "line": 2, + "column": 15, + "line": 5, }, }, "range": Array [ - 27, - 28, + 78, + 79, ], "type": "Punctuator", - "value": "?", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 19, + "line": 5, }, "start": Object { - "column": 8, - "line": 2, + "column": 17, + "line": 5, }, }, "range": Array [ - 28, - 29, + 80, + 82, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "as", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 25, + "line": 5, }, "start": Object { - "column": 9, - "line": 2, + "column": 20, + "line": 5, }, }, "range": Array [ - 29, - 30, + 83, + 88, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 26, + "line": 5, }, "start": Object { - "column": 10, - "line": 2, + "column": 25, + "line": 5, }, }, "range": Array [ - 30, - 31, + 88, + 89, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 3, + "line": 8, }, "start": Object { - "column": 12, - "line": 2, + "column": 0, + "line": 8, }, }, "range": Array [ - 32, - 35, + 128, + 131, ], - "type": "Identifier", - "value": "any", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 8, }, "start": Object { - "column": 15, - "line": 2, + "column": 4, + "line": 8, }, }, "range": Array [ - 35, - 36, + 132, + 133, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 7, + "line": 8, }, "start": Object { - "column": 0, - "line": 3, + "column": 6, + "line": 8, }, }, "range": Array [ - 37, - 38, + 134, + 135, ], "type": "Punctuator", - "value": "}", + "value": "=", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/declare-function.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "declare": true, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, }, - "name": "foo", - "range": Array [ - 17, - 20, - ], - "type": "Identifier", }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": "{", + }, + Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 14, + "line": 8, }, "start": Object { - "column": 0, - "line": 1, + "column": 10, + "line": 8, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 21, - 32, - ], - "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 [ - 0, - 42, + 138, + 142, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, + "type": "Identifier", + "value": "text", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, }, - "range": Array [ - 33, - 41, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 41, - ], - "type": "TSStringKeyword", + "start": Object { + "column": 14, + "line": 8, }, }, - "type": "TSDeclareFunction", - }, - ], - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "range": Array [ + 142, + 143, + ], + "type": "Punctuator", + "value": ":", }, - }, - "range": Array [ - 0, - 42, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 23, + "line": 8, }, "start": Object { - "column": 0, - "line": 1, + "column": 16, + "line": 8, }, }, "range": Array [ - 0, - 7, + 144, + 151, ], - "type": "Identifier", - "value": "declare", + "type": "String", + "value": "\\"hello\\"", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 25, + "line": 8, }, "start": Object { - "column": 8, - "line": 1, + "column": 24, + "line": 8, }, }, "range": Array [ - 8, - 16, + 152, + 153, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 28, + "line": 8, }, "start": Object { - "column": 17, - "line": 1, + "column": 26, + "line": 8, }, }, "range": Array [ - 17, - 20, + 154, + 156, ], "type": "Identifier", - "value": "foo", + "value": "as", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 34, + "line": 8, }, "start": Object { - "column": 20, - "line": 1, + "column": 29, + "line": 8, }, }, "range": Array [ - 20, - 21, + 157, + 162, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 35, + "line": 8, }, "start": Object { - "column": 21, - "line": 1, + "column": 34, + "line": 8, }, }, "range": Array [ - 21, - 24, + 162, + 163, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 3, + "line": 11, }, "start": Object { - "column": 24, - "line": 1, + "column": 0, + "line": 11, }, }, "range": Array [ - 24, - 25, + 178, + 181, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 5, + "line": 11, }, "start": Object { - "column": 26, - "line": 1, + "column": 4, + "line": 11, }, }, "range": Array [ - 26, - 32, + 182, + 183, ], "type": "Identifier", - "value": "string", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 7, + "line": 11, }, "start": Object { - "column": 32, - "line": 1, + "column": 6, + "line": 11, }, }, "range": Array [ - 32, - 33, + 184, + 185, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 9, + "line": 11, }, "start": Object { - "column": 33, - "line": 1, + "column": 8, + "line": 11, }, }, "range": Array [ - 33, - 34, + 186, + 187, ], "type": "Punctuator", - "value": ":", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 14, + "line": 11, }, "start": Object { - "column": 35, - "line": 1, + "column": 9, + "line": 11, }, }, "range": Array [ - 35, - 41, + 187, + 192, ], - "type": "Identifier", - "value": "string", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 15, + "line": 11, }, "start": Object { - "column": 41, - "line": 1, + "column": 14, + "line": 11, }, }, "range": Array [ - 41, - 42, + 192, + 193, ], "type": "Punctuator", - "value": ";", + "value": ">", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/destructuring-assignment.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 3, - 6, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 3, - 11, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 3, - 6, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "range": Array [ - 3, - 11, - ], - "right": Object { - "elements": Array [], - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 11, - ], - "type": "ArrayExpression", - }, - "type": "AssignmentPattern", - }, - }, - ], - "range": Array [ - 1, - 13, - ], - "type": "ObjectPattern", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "operator": "=", - "range": Array [ - 1, - 19, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 16, - 19, - ], - "type": "Identifier", - }, - "type": "AssignmentExpression", - }, "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 17, + "line": 11, }, "start": Object { - "column": 0, - "line": 1, + "column": 15, + "line": 11, }, }, "range": Array [ - 0, - 21, + 193, + 195, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Numeric", + "value": "10", }, - }, - "range": Array [ - 0, - 21, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, - "line": 1, + "column": 18, + "line": 11, }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 11, }, }, "range": Array [ - 0, - 1, + 195, + 196, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 1, + "column": 3, + "line": 14, }, "start": Object { - "column": 1, - "line": 1, + "column": 0, + "line": 14, }, }, "range": Array [ - 1, - 2, + 226, + 229, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 5, + "line": 14, }, "start": Object { - "column": 3, - "line": 1, + "column": 4, + "line": 14, }, }, "range": Array [ - 3, - 6, + 230, + 231, ], "type": "Identifier", - "value": "foo", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 7, + "line": 14, }, "start": Object { - "column": 7, - "line": 1, + "column": 6, + "line": 14, }, }, "range": Array [ - 7, - 8, + 232, + 233, ], "type": "Punctuator", "value": "=", @@ -36143,1216 +37068,287 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 9, + "line": 14, }, "start": Object { - "column": 9, - "line": 1, + "column": 8, + "line": 14, }, }, "range": Array [ - 9, - 10, + 234, + 235, ], "type": "Punctuator", - "value": "[", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 14, + "line": 14, }, "start": Object { - "column": 10, - "line": 1, + "column": 9, + "line": 14, }, }, "range": Array [ - 10, - 11, + 235, + 240, ], - "type": "Punctuator", - "value": "]", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 15, + "line": 14, }, "start": Object { - "column": 12, - "line": 1, + "column": 14, + "line": 14, }, }, "range": Array [ - 12, - 13, + 240, + 241, ], "type": "Punctuator", - "value": "}", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 16, + "line": 14, }, "start": Object { - "column": 14, - "line": 1, + "column": 15, + "line": 14, }, }, "range": Array [ - 14, - 15, + 241, + 242, ], "type": "Punctuator", - "value": "=", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 18, + "line": 14, }, "start": Object { "column": 16, - "line": 1, + "line": 14, }, }, "range": Array [ - 16, - 19, + 242, + 244, ], - "type": "Identifier", - "value": "bar", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 19, + "line": 14, }, "start": Object { - "column": 19, - "line": 1, + "column": 18, + "line": 14, }, }, "range": Array [ - 19, - 20, + 244, + 245, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 22, + "line": 14, }, "start": Object { "column": 20, - "line": 1, + "line": 14, }, }, "range": Array [ - 20, - 21, + 246, + 248, ], - "type": "Punctuator", - "value": ";", + "type": "Numeric", + "value": "20", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/destructuring-assignment-nested.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 81, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 3, - 6, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 79, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 3, - 79, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 73, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 71, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 10, - 71, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 66, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 17, - 20, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 64, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 17, - 64, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "left": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 28, - 31, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 28, - 42, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "left": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 34, - 35, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 36, - ], - "type": "ArrayPattern", - }, - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 42, - ], - "right": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 40, - "line": 1, - }, - }, - "range": Array [ - 40, - 41, - ], - "raw": "3", - "type": "Literal", - "value": 3, - }, - ], - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, - "range": Array [ - 39, - 42, - ], - "type": "ArrayExpression", - }, - "type": "AssignmentPattern", - }, - }, - ], - "range": Array [ - 26, - 44, - ], - "type": "ObjectPattern", - }, - "loc": Object { - "end": Object { - "column": 58, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 58, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 58, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 52, - "line": 1, - }, - "start": Object { - "column": 49, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 49, - 52, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 57, - "line": 1, - }, - "start": Object { - "column": 49, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 49, - 57, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 56, - "line": 1, - }, - "start": Object { - "column": 55, - "line": 1, - }, - }, - "range": Array [ - 55, - 56, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - ], - "loc": Object { - "end": Object { - "column": 57, - "line": 1, - }, - "start": Object { - "column": 54, - "line": 1, - }, - }, - "range": Array [ - 54, - 57, - ], - "type": "ArrayExpression", - }, - }, - ], - "range": Array [ - 47, - 58, - ], - "type": "ObjectExpression", - }, - "type": "AssignmentPattern", - }, - ], - "loc": Object { - "end": Object { - "column": 59, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 59, - ], - "type": "ArrayPattern", - }, - "loc": Object { - "end": Object { - "column": 64, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 64, - ], - "right": Object { - "elements": Array [], - "loc": Object { - "end": Object { - "column": 64, - "line": 1, - }, - "start": Object { - "column": 62, - "line": 1, - }, - }, - "range": Array [ - 62, - 64, - ], - "type": "ArrayExpression", - }, - "type": "AssignmentPattern", - }, - }, - ], - "range": Array [ - 15, - 66, - ], - "type": "ObjectPattern", - }, - "loc": Object { - "end": Object { - "column": 71, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 71, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 71, - "line": 1, - }, - "start": Object { - "column": 69, - "line": 1, - }, - }, - "properties": Array [], - "range": Array [ - 69, - 71, - ], - "type": "ObjectExpression", - }, - "type": "AssignmentPattern", - }, - }, - ], - "range": Array [ - 8, - 73, - ], - "type": "ObjectPattern", - }, - "loc": Object { - "end": Object { - "column": 79, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 79, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 79, - "line": 1, - }, - "start": Object { - "column": 76, - "line": 1, - }, - }, - "properties": Array [], - "range": Array [ - 76, - 79, - ], - "type": "ObjectExpression", - }, - "type": "AssignmentPattern", - }, - }, - ], - "range": Array [ - 1, - 81, - ], - "type": "ObjectPattern", - }, - "loc": Object { - "end": Object { - "column": 127, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "operator": "=", - "range": Array [ - 1, - 127, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 127, - "line": 1, - }, - "start": Object { - "column": 84, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 89, - "line": 1, - }, - "start": Object { - "column": 86, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 86, - 89, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 126, - "line": 1, - }, - "start": Object { - "column": 86, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 86, - 126, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 126, - "line": 1, - }, - "start": Object { - "column": 91, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 96, - "line": 1, - }, - "start": Object { - "column": 93, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 93, - 96, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 124, - "line": 1, - }, - "start": Object { - "column": 93, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 93, - 124, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 124, - "line": 1, - }, - "start": Object { - "column": 98, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 103, - "line": 1, - }, - "start": Object { - "column": 100, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 100, - 103, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 122, - "line": 1, - }, - "start": Object { - "column": 100, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 100, - 122, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 107, - "line": 1, - }, - "start": Object { - "column": 106, - "line": 1, - }, - }, - "range": Array [ - 106, - 107, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - Object { - "loc": Object { - "end": Object { - "column": 121, - "line": 1, - }, - "start": Object { - "column": 109, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 114, - "line": 1, - }, - "start": Object { - "column": 111, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 111, - 114, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 119, - "line": 1, - }, - "start": Object { - "column": 111, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 111, - 119, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 118, - "line": 1, - }, - "start": Object { - "column": 117, - "line": 1, - }, - }, - "range": Array [ - 117, - 118, - ], - "raw": "3", - "type": "Literal", - "value": 3, - }, - ], - "loc": Object { - "end": Object { - "column": 119, - "line": 1, - }, - "start": Object { - "column": 116, - "line": 1, - }, - }, - "range": Array [ - 116, - 119, - ], - "type": "ArrayExpression", - }, - }, - ], - "range": Array [ - 109, - 121, - ], - "type": "ObjectExpression", - }, - ], - "loc": Object { - "end": Object { - "column": 122, - "line": 1, - }, - "start": Object { - "column": 105, - "line": 1, - }, - }, - "range": Array [ - 105, - 122, - ], - "type": "ArrayExpression", - }, - }, - ], - "range": Array [ - 98, - 124, - ], - "type": "ObjectExpression", - }, - }, - ], - "range": Array [ - 91, - 126, - ], - "type": "ObjectExpression", - }, - }, - ], - "range": Array [ - 84, - 127, - ], - "type": "ObjectExpression", - }, - "type": "AssignmentExpression", - }, "loc": Object { "end": Object { - "column": 129, - "line": 1, + "column": 23, + "line": 14, }, "start": Object { - "column": 0, - "line": 1, + "column": 22, + "line": 14, }, }, "range": Array [ - 0, - 129, + 248, + 249, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "]", }, - }, - "range": Array [ - 0, - 130, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, - "line": 1, + "column": 24, + "line": 14, }, "start": Object { - "column": 0, - "line": 1, + "column": 23, + "line": 14, }, }, "range": Array [ - 0, - 1, + 249, + 250, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 1, + "column": 3, + "line": 17, }, "start": Object { - "column": 1, - "line": 1, + "column": 0, + "line": 17, }, }, "range": Array [ - 1, - 2, + 289, + 292, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 5, + "line": 17, }, "start": Object { - "column": 3, - "line": 1, + "column": 4, + "line": 17, }, }, "range": Array [ - 3, - 6, + 293, + 294, ], "type": "Identifier", - "value": "foo", + "value": "z", }, Object { "loc": Object { "end": Object { "column": 7, - "line": 1, + "line": 17, }, "start": Object { "column": 6, - "line": 1, + "line": 17, }, }, "range": Array [ - 6, - 7, + 295, + 296, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 1, + "line": 17, }, "start": Object { "column": 8, - "line": 1, + "line": 17, }, }, "range": Array [ - 8, - 9, + 297, + 298, ], "type": "Punctuator", - "value": "{", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 14, + "line": 17, }, "start": Object { - "column": 10, - "line": 1, + "column": 9, + "line": 17, }, }, "range": Array [ - 10, - 13, + 298, + 303, ], - "type": "Identifier", - "value": "bar", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 15, + "line": 17, }, "start": Object { - "column": 13, - "line": 1, + "column": 14, + "line": 17, }, }, "range": Array [ - 13, - 14, + 303, + 304, ], "type": "Punctuator", - "value": ":", + "value": ">", }, Object { "loc": Object { "end": Object { "column": 16, - "line": 1, + "line": 17, }, "start": Object { "column": 15, - "line": 1, + "line": 17, }, }, "range": Array [ - 15, - 16, + 304, + 305, ], "type": "Punctuator", "value": "{", @@ -37360,35 +37356,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 21, + "line": 17, }, "start": Object { "column": 17, - "line": 1, + "line": 17, }, }, "range": Array [ - 17, - 20, + 306, + 310, ], "type": "Identifier", - "value": "baz", + "value": "text", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 22, + "line": 17, }, "start": Object { - "column": 20, - "line": 1, + "column": 21, + "line": 17, }, }, "range": Array [ - 20, - 21, + 310, + 311, ], "type": "Punctuator", "value": ":", @@ -37396,1109 +37392,1140 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, + "column": 30, + "line": 17, }, "start": Object { "column": 23, - "line": 1, + "line": 17, }, }, "range": Array [ - 23, - 24, + 312, + 319, ], - "type": "Identifier", - "value": "a", + "type": "String", + "value": "\\"hello\\"", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 32, + "line": 17, }, "start": Object { - "column": 24, - "line": 1, + "column": 31, + "line": 17, }, }, "range": Array [ - 24, - 25, + 320, + 321, ], "type": "Punctuator", - "value": ",", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 33, + "line": 17, }, "start": Object { - "column": 26, - "line": 1, + "column": 32, + "line": 17, }, }, "range": Array [ - 26, - 27, + 321, + 322, ], "type": "Punctuator", - "value": "{", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/const-enum.src 1`] = ` +Object { + "body": Array [ Object { + "const": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 28, + "column": 0, "line": 1, }, }, + "members": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "TSEnumMember", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "TSEnumMember", + }, + ], "range": Array [ - 28, - 31, + 0, + 39, ], - "type": "Identifier", - "value": "foo", + "type": "TSEnumDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 32, + "column": 5, "line": 1, }, "start": Object { - "column": 31, + "column": 0, "line": 1, }, }, "range": Array [ - 31, - 32, + 0, + 5, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 10, "line": 1, }, "start": Object { - "column": 33, + "column": 6, "line": 1, }, }, "range": Array [ - 33, - 34, + 6, + 10, ], - "type": "Punctuator", - "value": "[", + "type": "Keyword", + "value": "enum", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 14, "line": 1, }, "start": Object { - "column": 34, + "column": 11, "line": 1, }, }, "range": Array [ - 34, - 35, + 11, + 14, ], "type": "Identifier", - "value": "x", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 16, "line": 1, }, "start": Object { - "column": 35, + "column": 15, "line": 1, }, }, "range": Array [ - 35, - 36, + 15, + 16, ], "type": "Punctuator", - "value": "]", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 37, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 37, - 38, + 21, + 24, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 39, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 39, - 40, + 25, + 26, ], "type": "Punctuator", - "value": "[", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 40, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 40, - 41, + 27, + 28, ], "type": "Numeric", - "value": "3", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 41, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 41, - 42, + 28, + 29, ], "type": "Punctuator", - "value": "]", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 43, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 43, - 44, + 34, + 37, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 45, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 45, - 46, + 38, + 39, ], "type": "Punctuator", - "value": "=", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/declare-class-with-optional-method.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "optional": true, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 24, + 36, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 28, + 36, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "TSAnyKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 1, + }, }, - "start": Object { - "column": 47, - "line": 1, + "range": Array [ + 18, + 38, + ], + "type": "ClassBody", + }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", }, - "range": Array [ - 47, - 48, - ], - "type": "Punctuator", - "value": "{", - }, - Object { "loc": Object { "end": Object { - "column": 52, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 49, + "column": 0, "line": 1, }, }, "range": Array [ - 49, - 52, + 0, + 38, ], - "type": "Identifier", - "value": "foo", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 53, + "column": 7, "line": 1, }, "start": Object { - "column": 52, + "column": 0, "line": 1, }, }, "range": Array [ - 52, - 53, + 0, + 7, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 55, + "column": 13, "line": 1, }, "start": Object { - "column": 54, + "column": 8, "line": 1, }, }, "range": Array [ - 54, - 55, + 8, + 13, ], - "type": "Punctuator", - "value": "[", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 56, + "column": 17, "line": 1, }, "start": Object { - "column": 55, + "column": 14, "line": 1, }, }, "range": Array [ - 55, - 56, + 14, + 17, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 57, + "column": 19, "line": 1, }, "start": Object { - "column": 56, + "column": 18, "line": 1, }, }, "range": Array [ - 56, - 57, + 18, + 19, ], "type": "Punctuator", - "value": "]", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 58, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 57, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 57, - 58, + 24, + 27, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 59, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 58, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 58, - 59, + 27, + 28, ], "type": "Punctuator", - "value": "]", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 61, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 60, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 60, - 61, + 28, + 29, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 63, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 62, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 62, - 63, + 29, + 30, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 64, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 63, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 63, - 64, + 30, + 31, ], "type": "Punctuator", - "value": "]", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 66, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 65, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 65, - 66, + 32, + 35, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 68, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 67, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 67, - 68, + 35, + 36, ], "type": "Punctuator", - "value": "=", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 70, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 69, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 69, - 70, + 37, + 38, ], "type": "Punctuator", - "value": "{", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/declare-function.src 1`] = ` +Object { + "body": Array [ Object { + "async": false, + "declare": true, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 71, + "column": 42, "line": 1, }, "start": Object { - "column": 70, + "column": 0, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 21, + 32, + ], + "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 [ - 70, - 71, + 0, + 42, ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 73, - "line": 1, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, }, - "start": Object { - "column": 72, - "line": 1, + "range": Array [ + 33, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSStringKeyword", }, }, - "range": Array [ - 72, - 73, - ], - "type": "Punctuator", - "value": "}", + "type": "TSDeclareFunction", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 75, + "column": 7, "line": 1, }, "start": Object { - "column": 74, + "column": 0, "line": 1, }, }, "range": Array [ - 74, - 75, + 0, + 7, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 77, + "column": 16, "line": 1, }, "start": Object { - "column": 76, + "column": 8, "line": 1, }, }, "range": Array [ - 76, - 77, + 8, + 16, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 79, + "column": 20, "line": 1, }, "start": Object { - "column": 78, + "column": 17, "line": 1, }, }, "range": Array [ - 78, - 79, + 17, + 20, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 81, + "column": 21, "line": 1, }, "start": Object { - "column": 80, + "column": 20, "line": 1, }, }, "range": Array [ - 80, - 81, + 20, + 21, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 83, + "column": 24, "line": 1, }, "start": Object { - "column": 82, + "column": 21, "line": 1, }, }, "range": Array [ - 82, - 83, + 21, + 24, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 85, + "column": 25, "line": 1, }, "start": Object { - "column": 84, + "column": 24, "line": 1, }, }, "range": Array [ - 84, - 85, + 24, + 25, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 89, + "column": 32, "line": 1, }, "start": Object { - "column": 86, + "column": 26, "line": 1, }, }, "range": Array [ - 86, - 89, + 26, + 32, ], "type": "Identifier", - "value": "foo", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 90, + "column": 33, "line": 1, }, "start": Object { - "column": 89, + "column": 32, "line": 1, }, }, "range": Array [ - 89, - 90, + 32, + 33, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 92, + "column": 34, "line": 1, }, "start": Object { - "column": 91, + "column": 33, "line": 1, }, }, "range": Array [ - 91, - 92, + 33, + 34, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 96, + "column": 41, "line": 1, }, "start": Object { - "column": 93, + "column": 35, "line": 1, }, }, "range": Array [ - 93, - 96, + 35, + 41, ], "type": "Identifier", - "value": "bar", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 97, + "column": 42, "line": 1, }, "start": Object { - "column": 96, + "column": 41, "line": 1, }, }, "range": Array [ - 96, - 97, + 41, + 42, ], "type": "Punctuator", - "value": ":", + "value": ";", }, - Object { - "loc": Object { - "end": Object { - "column": 99, - "line": 1, - }, - "start": Object { - "column": 98, - "line": 1, - }, - }, - "range": Array [ - 98, - 99, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 103, - "line": 1, - }, - "start": Object { - "column": 100, - "line": 1, - }, - }, - "range": Array [ - 100, - 103, - ], - "type": "Identifier", - "value": "baz", - }, - Object { - "loc": Object { - "end": Object { - "column": 104, - "line": 1, - }, - "start": Object { - "column": 103, - "line": 1, - }, - }, - "range": Array [ - 103, - 104, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 106, - "line": 1, - }, - "start": Object { - "column": 105, - "line": 1, - }, - }, - "range": Array [ - 105, - 106, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 107, - "line": 1, - }, - "start": Object { - "column": 106, - "line": 1, - }, - }, - "range": Array [ - 106, - 107, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 108, - "line": 1, - }, - "start": Object { - "column": 107, - "line": 1, - }, - }, - "range": Array [ - 107, - 108, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 110, - "line": 1, - }, - "start": Object { - "column": 109, - "line": 1, - }, - }, - "range": Array [ - 109, - 110, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 114, - "line": 1, - }, - "start": Object { - "column": 111, - "line": 1, - }, - }, - "range": Array [ - 111, - 114, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 115, - "line": 1, - }, - "start": Object { - "column": 114, - "line": 1, - }, - }, - "range": Array [ - 114, - 115, - ], - "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 117, - "line": 1, - }, - "start": Object { - "column": 116, - "line": 1, - }, - }, - "range": Array [ - 116, - 117, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 118, - "line": 1, - }, - "start": Object { - "column": 117, - "line": 1, - }, - }, - "range": Array [ - 117, - 118, - ], - "type": "Numeric", - "value": "3", - }, - Object { - "loc": Object { - "end": Object { - "column": 119, - "line": 1, - }, - "start": Object { - "column": 118, - "line": 1, - }, - }, - "range": Array [ - 118, - 119, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 121, - "line": 1, - }, - "start": Object { - "column": 120, - "line": 1, - }, - }, - "range": Array [ - 120, - 121, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 122, - "line": 1, - }, - "start": Object { - "column": 121, - "line": 1, - }, - }, - "range": Array [ - 121, - 122, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 124, - "line": 1, - }, - "start": Object { - "column": 123, - "line": 1, - }, - }, - "range": Array [ - 123, - 124, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 126, - "line": 1, - }, - "start": Object { - "column": 125, - "line": 1, - }, - }, - "range": Array [ - 125, - 126, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 127, - "line": 1, - }, - "start": Object { - "column": 126, - "line": 1, - }, - }, - "range": Array [ - 126, - 127, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 128, - "line": 1, - }, - "start": Object { - "column": 127, - "line": 1, - }, - }, - "range": Array [ - 127, - 128, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 129, - "line": 1, - }, - "start": Object { - "column": 128, - "line": 1, - }, - }, - "range": Array [ - 128, - 129, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/destructuring-assignment-object.src 1`] = ` -Object { - "body": Array [ + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/destructuring-assignment.src 1`] = ` +Object { + "body": Array [ Object { "expression": Object { "left": Object { @@ -38585,6 +38612,7 @@ Object { 11, ], "right": Object { + "elements": Array [], "loc": Object { "end": Object { "column": 11, @@ -38595,12 +38623,11 @@ Object { "line": 1, }, }, - "properties": Array [], "range": Array [ 9, 11, ], - "type": "ObjectExpression", + "type": "ArrayExpression", }, "type": "AssignmentPattern", }, @@ -38666,8 +38693,8 @@ Object { ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { "column": 0, @@ -38676,7 +38703,7 @@ Object { }, "range": Array [ 0, - 22, + 21, ], "sourceType": "script", "tokens": Array [ @@ -38768,7 +38795,7 @@ Object { 10, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { @@ -38786,7 +38813,7 @@ Object { 11, ], "type": "Punctuator", - "value": "}", + "value": "]", }, Object { "loc": Object { @@ -38883,218 +38910,936 @@ Object { } `; -exports[`typescript fixtures/basics/destructuring-assignment-property.src 1`] = ` +exports[`typescript fixtures/basics/destructuring-assignment-nested.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 37, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 81, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, }, - }, - "name": "Foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 3, + 6, + ], + "type": "Identifier", }, - "start": Object { - "column": 13, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { + "method": false, + "range": Array [ + 3, + 79, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { "loc": Object { "end": Object { - "column": 18, + "column": 73, "line": 1, }, "start": Object { - "column": 15, + "column": 8, "line": 1, }, }, - "name": "foo", + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 10, + 71, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 66, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 17, + 64, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 28, + 42, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 36, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 42, + ], + "right": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 26, + 44, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 58, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 49, + 57, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "ArrayExpression", + }, + }, + ], + "range": Array [ + 47, + 58, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 59, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 64, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 64, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 15, + 66, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 71, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 69, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 69, + 71, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", + }, + }, + ], "range": Array [ - 15, - 18, + 8, + 73, ], - "type": "Identifier", + "type": "ObjectPattern", }, - "kind": "init", "loc": Object { "end": Object { - "column": 23, + "column": 79, "line": 1, }, "start": Object { - "column": 15, + "column": 8, "line": 1, }, }, - "method": false, "range": Array [ - 15, - 23, + 8, + 79, ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, + "right": Object { "loc": Object { "end": Object { - "column": 23, + "column": 79, "line": 1, }, "start": Object { - "column": 15, + "column": 76, "line": 1, }, }, + "properties": Array [], "range": Array [ - 15, - 23, + 76, + 79, ], - "right": Object { - "elements": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 23, - ], - "type": "ArrayExpression", - }, - "type": "AssignmentPattern", + "type": "ObjectExpression", }, + "type": "AssignmentPattern", }, - ], - "range": Array [ - 13, - 25, - ], - "type": "ObjectPattern", + }, + ], + "range": Array [ + 1, + 81, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 127, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, }, + }, + "operator": "=", + "range": Array [ + 1, + 127, + ], + "right": Object { "loc": Object { "end": Object { - "column": 31, + "column": 127, "line": 1, }, "start": Object { - "column": 13, + "column": 84, "line": 1, }, }, - "range": Array [ - 13, - 31, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 89, + "line": 1, + }, + "start": Object { + "column": 86, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 86, + 89, + ], + "type": "Identifier", }, - "start": Object { - "column": 28, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 126, + "line": 1, + }, + "start": Object { + "column": 86, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 86, + 126, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 126, + "line": 1, + }, + "start": Object { + "column": 91, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 96, + "line": 1, + }, + "start": Object { + "column": 93, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 93, + 96, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 124, + "line": 1, + }, + "start": Object { + "column": 93, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 93, + 124, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 124, + "line": 1, + }, + "start": Object { + "column": 98, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 103, + "line": 1, + }, + "start": Object { + "column": 100, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 100, + 103, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 122, + "line": 1, + }, + "start": Object { + "column": 100, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 100, + 122, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 107, + "line": 1, + }, + "start": Object { + "column": 106, + "line": 1, + }, + }, + "range": Array [ + 106, + 107, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + Object { + "loc": Object { + "end": Object { + "column": 121, + "line": 1, + }, + "start": Object { + "column": 109, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 114, + "line": 1, + }, + "start": Object { + "column": 111, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 111, + 114, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 119, + "line": 1, + }, + "start": Object { + "column": 111, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 111, + 119, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 118, + "line": 1, + }, + "start": Object { + "column": 117, + "line": 1, + }, + }, + "range": Array [ + 117, + 118, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + ], + "loc": Object { + "end": Object { + "column": 119, + "line": 1, + }, + "start": Object { + "column": 116, + "line": 1, + }, + }, + "range": Array [ + 116, + 119, + ], + "type": "ArrayExpression", + }, + }, + ], + "range": Array [ + 109, + 121, + ], + "type": "ObjectExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 122, + "line": 1, + }, + "start": Object { + "column": 105, + "line": 1, + }, + }, + "range": Array [ + 105, + 122, + ], + "type": "ArrayExpression", + }, + }, + ], + "range": Array [ + 98, + 124, + ], + "type": "ObjectExpression", + }, + }, + ], + "range": Array [ + 91, + 126, + ], + "type": "ObjectExpression", }, }, - "name": "bar", - "range": Array [ - 28, - 31, - ], - "type": "Identifier", - }, - "type": "AssignmentPattern", + ], + "range": Array [ + 84, + 127, + ], + "type": "ObjectExpression", }, - ], + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 129, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ 0, - 37, + 129, ], - "type": "FunctionDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -39103,14 +39848,14 @@ Object { }, "range": Array [ 0, - 38, + 130, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -39120,28 +39865,82 @@ Object { }, "range": Array [ 0, - 8, + 1, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, "line": 1, }, "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { "column": 9, "line": 1, }, + "start": Object { + "column": 8, + "line": 1, + }, }, "range": Array [ + 8, 9, - 12, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { @@ -39150,16 +39949,16 @@ Object { "line": 1, }, "start": Object { - "column": 12, + "column": 10, "line": 1, }, }, "range": Array [ - 12, + 10, 13, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { @@ -39177,12 +39976,12 @@ Object { 14, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { @@ -39192,10 +39991,10 @@ Object { }, "range": Array [ 15, - 18, + 16, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { @@ -39204,34 +40003,34 @@ Object { "line": 1, }, "start": Object { - "column": 19, + "column": 17, "line": 1, }, }, "range": Array [ - 19, + 17, 20, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 21, "line": 1, }, "start": Object { - "column": 21, + "column": 20, "line": 1, }, }, "range": Array [ + 20, 21, - 22, ], "type": "Punctuator", - "value": "[", + "value": ":", }, Object { "loc": Object { @@ -39249,7 +40048,25 @@ Object { 23, ], "type": "Punctuator", - "value": "]", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -39267,7 +40084,7 @@ Object { 25, ], "type": "Punctuator", - "value": "}", + "value": ",", }, Object { "loc": Object { @@ -39285,7 +40102,7 @@ Object { 27, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { @@ -39303,7 +40120,7 @@ Object { 31, ], "type": "Identifier", - "value": "bar", + "value": "foo", }, Object { "loc": Object { @@ -39321,7 +40138,7 @@ Object { 32, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { @@ -39339,284 +40156,184 @@ Object { 34, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, }, }, "range": Array [ + 35, 36, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ 37, + 38, ], "type": "Punctuator", - "value": "}", + "value": "=", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/directive-in-module.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "directive": "use strict", - "expression": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 15, - 27, - ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 15, - 28, - ], - "type": "ExpressionStatement", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "name": "a", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 39, - 40, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 35, - 40, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 31, - 41, - ], - "type": "VariableDeclaration", - }, - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 44, - 56, - ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 44, - 57, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 11, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, }, - "range": Array [ - 11, - 59, - ], - "type": "TSModuleBlock", }, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, }, - "name": "foo", - "range": Array [ - 7, - 10, - ], - "type": "Identifier", }, + "range": Array [ + 40, + 41, + ], + "type": "Numeric", + "value": "3", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 42, + "line": 1, }, "start": Object { - "column": 0, + "column": 41, "line": 1, }, }, "range": Array [ - 0, - 59, + 41, + 42, ], - "type": "TSModuleDeclaration", + "type": "Punctuator", + "value": "]", }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 6, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "}", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "=", }, - }, - "range": Array [ - 0, - 60, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 48, "line": 1, }, "start": Object { - "column": 0, + "column": 47, "line": 1, }, }, "range": Array [ - 0, - 6, + 47, + 48, ], - "type": "Identifier", - "value": "module", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 52, "line": 1, }, "start": Object { - "column": 7, + "column": 49, "line": 1, }, }, "range": Array [ - 7, - 10, + 49, + 52, ], "type": "Identifier", "value": "foo", @@ -39624,107 +40341,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 53, "line": 1, }, "start": Object { - "column": 11, + "column": 52, "line": 1, }, }, "range": Array [ - 11, - 12, + 52, + 53, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 55, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 54, + "line": 1, }, }, "range": Array [ - 15, - 27, + 54, + 55, ], - "type": "String", - "value": "\\"use strict\\"", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 56, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 55, + "line": 1, }, }, "range": Array [ - 27, - 28, + 55, + 56, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 56, + "line": 1, + }, + }, + "range": Array [ + 56, + 57, ], "type": "Punctuator", - "value": ";", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 58, + "line": 1, }, "start": Object { - "column": 2, - "line": 3, + "column": 57, + "line": 1, }, }, "range": Array [ - 31, - 34, + 57, + 58, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 59, + "line": 1, }, "start": Object { - "column": 6, - "line": 3, + "column": 58, + "line": 1, }, }, "range": Array [ - 35, - 36, + 58, + 59, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 61, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 60, + "line": 1, }, }, "range": Array [ - 37, - 38, + 60, + 61, ], "type": "Punctuator", "value": "=", @@ -39732,369 +40467,233 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, + "column": 63, + "line": 1, }, "start": Object { - "column": 10, - "line": 3, + "column": 62, + "line": 1, }, }, "range": Array [ - 39, - 40, + 62, + 63, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 64, + "line": 1, }, "start": Object { - "column": 11, - "line": 3, + "column": 63, + "line": 1, }, }, "range": Array [ - 40, - 41, + 63, + 64, ], "type": "Punctuator", - "value": ";", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 66, + "line": 1, }, "start": Object { - "column": 2, - "line": 4, + "column": 65, + "line": 1, }, }, "range": Array [ - 44, - 56, + 65, + 66, ], - "type": "String", - "value": "\\"use strict\\"", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 4, + "column": 68, + "line": 1, }, "start": Object { - "column": 14, - "line": 4, + "column": 67, + "line": 1, }, }, "range": Array [ - 56, - 57, + 67, + 68, ], "type": "Punctuator", - "value": ";", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 70, + "line": 1, }, "start": Object { - "column": 0, - "line": 5, + "column": 69, + "line": 1, }, }, "range": Array [ - 58, - 59, + 69, + 70, ], "type": "Punctuator", - "value": "}", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/directive-in-namespace.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "directive": "use strict", - "expression": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 18, - 30, - ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 18, - 31, - ], - "type": "ExpressionStatement", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "name": "a", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 42, - 43, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 38, - 43, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 34, - 44, - ], - "type": "VariableDeclaration", - }, - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 47, - 59, - ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 47, - 60, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 70, + "line": 1, }, - "range": Array [ - 14, - 62, - ], - "type": "TSModuleBlock", }, - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 72, + "line": 1, }, - "name": "foo", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "}", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 75, + "line": 1, }, "start": Object { - "column": 0, + "column": 74, "line": 1, }, }, "range": Array [ - 0, - 62, + 74, + 75, ], - "type": "TSModuleDeclaration", + "type": "Punctuator", + "value": "=", }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 6, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 76, + "line": 1, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "{", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 63, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 81, "line": 1, }, "start": Object { - "column": 0, + "column": 80, "line": 1, }, }, "range": Array [ - 0, - 9, + 80, + 81, ], - "type": "Identifier", - "value": "namespace", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 83, "line": 1, }, "start": Object { - "column": 10, + "column": 82, "line": 1, }, }, "range": Array [ - 10, - 13, + 82, + 83, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 85, "line": 1, }, "start": Object { - "column": 14, + "column": 84, "line": 1, }, }, "range": Array [ - 14, - 15, + 84, + 85, ], "type": "Punctuator", "value": "{", @@ -40102,461 +40701,431 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 89, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 86, + "line": 1, }, }, "range": Array [ - 18, - 30, + 86, + 89, ], - "type": "String", - "value": "\\"use strict\\"", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 90, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 89, + "line": 1, }, }, "range": Array [ - 30, - 31, + 89, + 90, ], "type": "Punctuator", - "value": ";", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 92, + "line": 1, }, "start": Object { - "column": 2, - "line": 3, + "column": 91, + "line": 1, }, }, "range": Array [ - 34, - 37, + 91, + 92, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 96, + "line": 1, }, "start": Object { - "column": 6, - "line": 3, + "column": 93, + "line": 1, }, }, "range": Array [ - 38, - 39, + 93, + 96, ], "type": "Identifier", - "value": "a", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 97, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 96, + "line": 1, }, }, "range": Array [ - 40, - 41, + 96, + 97, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, + "column": 99, + "line": 1, }, "start": Object { - "column": 10, - "line": 3, + "column": 98, + "line": 1, }, }, "range": Array [ - 42, - 43, + 98, + 99, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 103, + "line": 1, }, "start": Object { - "column": 11, - "line": 3, + "column": 100, + "line": 1, }, }, "range": Array [ - 43, - 44, + 100, + 103, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 104, + "line": 1, }, "start": Object { - "column": 2, - "line": 4, + "column": 103, + "line": 1, }, }, "range": Array [ - 47, - 59, + 103, + 104, ], - "type": "String", - "value": "\\"use strict\\"", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 4, + "column": 106, + "line": 1, }, "start": Object { - "column": 14, - "line": 4, + "column": 105, + "line": 1, }, }, "range": Array [ - 59, - 60, + 105, + 106, ], "type": "Punctuator", - "value": ";", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 107, + "line": 1, }, "start": Object { - "column": 0, - "line": 5, + "column": 106, + "line": 1, }, }, "range": Array [ - 61, - 62, + 106, + 107, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "2", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/export-as-namespace.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 108, + "line": 1, + }, + "start": Object { + "column": 107, + "line": 1, }, - "name": "a", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ",", + }, + Object { "loc": Object { "end": Object { - "column": 22, + "column": 110, "line": 1, }, "start": Object { - "column": 0, + "column": 109, "line": 1, }, }, "range": Array [ - 0, - 22, + 109, + 110, ], - "type": "TSNamespaceExportDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 23, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 114, "line": 1, }, "start": Object { - "column": 0, + "column": 111, "line": 1, }, }, "range": Array [ - 0, - 6, + 111, + 114, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 115, "line": 1, }, "start": Object { - "column": 7, + "column": 114, "line": 1, }, }, "range": Array [ - 7, - 9, + 114, + 115, ], - "type": "Identifier", - "value": "as", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 117, "line": 1, }, "start": Object { - "column": 10, + "column": 116, "line": 1, }, }, "range": Array [ - 10, - 19, + 116, + 117, ], - "type": "Identifier", - "value": "namespace", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 118, "line": 1, }, "start": Object { - "column": 20, + "column": 117, "line": 1, }, }, "range": Array [ - 20, - 21, + 117, + 118, ], - "type": "Identifier", - "value": "a", + "type": "Numeric", + "value": "3", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 119, "line": 1, }, "start": Object { - "column": 21, + "column": 118, "line": 1, }, }, "range": Array [ - 21, - 22, + 118, + 119, ], "type": "Punctuator", - "value": ";", + "value": "]", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/export-assignment.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 121, + "line": 1, + }, + "start": Object { + "column": 120, + "line": 1, }, - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", }, + "range": Array [ + 120, + 121, + ], + "type": "Punctuator", + "value": "}", + }, + Object { "loc": Object { "end": Object { - "column": 13, + "column": 122, "line": 1, }, "start": Object { - "column": 0, + "column": 121, "line": 1, }, }, "range": Array [ - 0, - 13, + 121, + 122, ], - "type": "TSExportAssignment", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, + "type": "Punctuator", + "value": "]", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 124, + "line": 1, + }, + "start": Object { + "column": 123, + "line": 1, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 14, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 126, "line": 1, }, "start": Object { - "column": 0, + "column": 125, "line": 1, }, }, "range": Array [ - 0, - 6, + 125, + 126, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 127, "line": 1, }, "start": Object { - "column": 7, + "column": 126, "line": 1, }, }, "range": Array [ - 7, - 8, + 126, + 127, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 128, "line": 1, }, "start": Object { - "column": 9, + "column": 127, "line": 1, }, }, "range": Array [ - 9, - 12, + 127, + 128, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 129, "line": 1, }, "start": Object { - "column": 12, + "column": 128, "line": 1, }, }, "range": Array [ - 12, - 13, + 128, + 129, ], "type": "Punctuator", "value": ";", @@ -40566,142 +41135,161 @@ Object { } `; -exports[`typescript fixtures/basics/export-declare-const-named-enum.src 1`] = ` +exports[`typescript fixtures/basics/destructuring-assignment-object.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "const": true, - "declare": true, - "id": Object { + "expression": Object { + "left": Object { "loc": Object { "end": Object { - "column": 29, + "column": 13, "line": 1, }, "start": Object { - "column": 26, + "column": 1, "line": 1, }, }, - "name": "Foo", - "range": Array [ - 26, - 29, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "members": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 3, + 6, + ], + "type": "Identifier", }, - "name": "foo", - "range": Array [ - 36, - 39, - ], - "type": "Identifier", - }, - "initializer": Object { + "kind": "init", "loc": Object { "end": Object { "column": 11, - "line": 2, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 3, + "line": 1, }, }, + "method": false, "range": Array [ - 42, - 43, + 3, + 11, ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 36, - 43, - ], - "type": "TSEnumMember", - }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 3, + 6, + ], + "type": "Identifier", }, - "start": Object { - "column": 4, - "line": 3, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, }, - }, - "name": "bar", - "range": Array [ - 49, - 52, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, + "range": Array [ + 3, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 9, + 11, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", }, }, - "range": Array [ - 49, - 52, - ], - "type": "TSEnumMember", + ], + "range": Array [ + 1, + 13, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, }, - ], + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", "range": Array [ - 7, - 54, + 1, + 19, ], - "type": "TSEnumDeclaration", + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 21, + "line": 1, }, "start": Object { "column": 0, @@ -40710,17 +41298,15 @@ Object { }, "range": Array [ 0, - 54, + 21, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 2, }, "start": Object { "column": 0, @@ -40729,14 +41315,14 @@ Object { }, "range": Array [ 0, - 55, + 22, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 1, "line": 1, }, "start": Object { @@ -40746,133 +41332,133 @@ Object { }, "range": Array [ 0, - 6, + 1, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 2, "line": 1, }, "start": Object { - "column": 7, + "column": 1, "line": 1, }, }, "range": Array [ - 7, - 14, + 1, + 2, ], - "type": "Identifier", - "value": "declare", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 6, "line": 1, }, "start": Object { - "column": 15, + "column": 3, "line": 1, }, }, "range": Array [ - 15, - 20, + 3, + 6, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 8, "line": 1, }, "start": Object { - "column": 21, + "column": 7, "line": 1, }, }, "range": Array [ - 21, - 25, + 7, + 8, ], - "type": "Keyword", - "value": "enum", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 10, "line": 1, }, "start": Object { - "column": 26, + "column": 9, "line": 1, }, }, "range": Array [ - 26, - 29, + 9, + 10, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 11, "line": 1, }, "start": Object { - "column": 30, + "column": 10, "line": 1, }, }, "range": Array [ - 30, - 31, + 10, + 11, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 13, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 12, + "line": 1, }, }, "range": Array [ - 36, - 39, + 12, + 13, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 40, - 41, + 14, + 15, ], "type": "Punctuator", "value": "=", @@ -40880,234 +41466,274 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 19, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ - 42, - 43, + 16, + 19, ], - "type": "Numeric", - "value": "1", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 19, + "line": 1, }, }, "range": Array [ - 43, - 44, + 19, + 20, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 49, - 52, - ], - "type": "Identifier", - "value": "bar", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 21, + "line": 1, }, "start": Object { - "column": 0, - "line": 4, + "column": 20, + "line": 1, }, }, "range": Array [ - 53, - 54, + 20, + 21, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/export-declare-named-enum.src 1`] = ` +exports[`typescript fixtures/basics/destructuring-assignment-property.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "declare": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, }, - "name": "Foo", - "range": Array [ - 20, - 23, - ], - "type": "Identifier", }, + "range": Array [ + 33, + 37, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 12, + "line": 1, }, "start": Object { - "column": 7, + "column": 9, "line": 1, }, }, - "members": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 30, - 33, - ], - "type": "Identifier", - }, - "initializer": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 36, - 37, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + "name": "Foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "left": Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 13, + "line": 1, }, }, - "range": Array [ - 30, - 37, - ], - "type": "TSEnumMember", - }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", }, - "start": Object { - "column": 4, - "line": 3, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 15, + 23, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentPattern", }, }, - "name": "bar", - "range": Array [ - 43, - 46, - ], - "type": "Identifier", + ], + "range": Array [ + 13, + 25, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, }, + }, + "range": Array [ + 13, + 31, + ], + "right": Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 31, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 28, + "line": 1, }, }, + "name": "bar", "range": Array [ - 43, - 46, + 28, + 31, ], - "type": "TSEnumMember", + "type": "Identifier", }, - ], - "range": Array [ - 7, - 48, - ], - "type": "TSEnumDeclaration", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "AssignmentPattern", }, - }, + ], "range": Array [ 0, - 48, + 37, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 4, }, "start": Object { "column": 0, @@ -41116,14 +41742,14 @@ Object { }, "range": Array [ 0, - 49, + 38, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -41133,10 +41759,46 @@ Object { }, "range": Array [ 0, - 6, + 8, ], "type": "Keyword", - "value": "export", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -41145,21 +41807,21 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, "range": Array [ - 7, + 13, 14, ], - "type": "Identifier", - "value": "declare", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 18, "line": 1, }, "start": Object { @@ -41169,79 +41831,97 @@ Object { }, "range": Array [ 15, - 19, + 18, ], - "type": "Keyword", - "value": "enum", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 20, "line": 1, }, "start": Object { - "column": 20, + "column": 19, "line": 1, }, }, "range": Array [ + 19, 20, - 23, ], - "type": "Identifier", - "value": "Foo", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 22, "line": 1, }, "start": Object { - "column": 24, + "column": 21, "line": 1, }, }, "range": Array [ - 24, - 25, + 21, + 22, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ - 30, - 33, + 22, + 23, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 24, + "line": 1, }, }, "range": Array [ - 34, - 35, + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, ], "type": "Punctuator", "value": "=", @@ -41249,71 +41929,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 31, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 28, + "line": 1, }, }, "range": Array [ - 36, - 37, + 28, + 31, ], - "type": "Numeric", - "value": "1", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 32, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 31, + "line": 1, }, }, "range": Array [ - 37, - 38, + 31, + 32, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 34, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 33, + "line": 1, }, }, "range": Array [ - 43, - 46, + 33, + 34, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, - "line": 4, + "line": 3, }, }, "range": Array [ - 47, - 48, + 36, + 37, ], "type": "Punctuator", "value": "}", @@ -41323,105 +42003,198 @@ Object { } `; -exports[`typescript fixtures/basics/export-default-class-with-generic.src 1`] = ` +exports[`typescript fixtures/basics/directive-in-module.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 28, - ], - "type": "ClassBody", - }, - "id": null, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 28, - ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "params": Array [ - Object { + "body": Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 2, + "line": 2, }, }, - "name": Object { + "range": Array [ + 15, + 27, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 28, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 21, - "line": 1, + "column": 6, + "line": 3, }, }, - "name": "T", "range": Array [ - 21, - 22, + 35, + 40, ], - "type": "Identifier", + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 31, + 41, + ], + "type": "VariableDeclaration", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, }, "range": Array [ - 21, - 22, + 44, + 56, ], - "type": "TSTypeParameter", + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", }, - ], - "range": Array [ - 20, - 23, - ], - "type": "TSTypeParameterDeclaration", + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 44, + 57, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 59, + ], + "type": "TSModuleBlock", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -41430,15 +42203,15 @@ Object { }, "range": Array [ 0, - 28, + 59, ], - "type": "ExportDefaultDeclaration", + "type": "TSModuleDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -41447,9 +42220,9 @@ Object { }, "range": Array [ 0, - 29, + 60, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { @@ -41466,13 +42239,13 @@ Object { 0, 6, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "module", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 10, "line": 1, }, "start": Object { @@ -41482,115 +42255,205 @@ Object { }, "range": Array [ 7, - 14, + 10, ], - "type": "Keyword", - "value": "default", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 12, "line": 1, }, "start": Object { - "column": 15, + "column": 11, "line": 1, }, }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, "range": Array [ 15, - 20, + 27, ], - "type": "Keyword", - "value": "class", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 20, - 21, + 27, + 28, ], "type": "Punctuator", - "value": "<", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 21, - "line": 1, + "column": 2, + "line": 3, }, }, "range": Array [ - 21, - 22, + 31, + 34, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, ], "type": "Identifier", - "value": "T", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 9, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 8, + "line": 3, }, }, "range": Array [ - 22, - 23, + 37, + 38, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 24, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 24, - 25, + 39, + 40, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, ], "type": "Punctuator", - "value": "{", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 44, + 56, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 27, - 28, + 58, + 59, ], "type": "Punctuator", "value": "}", @@ -41600,140 +42463,198 @@ Object { } `; -exports[`typescript fixtures/basics/export-default-class-with-multiple-generics.src 1`] = ` +exports[`typescript fixtures/basics/directive-in-namespace.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + "body": Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 30, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 31, - ], - "type": "ClassBody", - }, - "id": null, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 31, - ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, }, + "range": Array [ + 18, + 31, + ], + "type": "ExpressionStatement", }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", }, - "start": Object { - "column": 21, - "line": 1, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - }, - "name": Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 21, - "line": 1, + "column": 6, + "line": 3, }, }, - "name": "T", "range": Array [ - 21, - 22, + 38, + 43, ], - "type": "Identifier", + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, }, - "range": Array [ - 21, - 22, - ], - "type": "TSTypeParameter", }, - Object { + "range": Array [ + 34, + 44, + ], + "type": "VariableDeclaration", + }, + Object { + "expression": Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 14, + "line": 4, }, "start": Object { - "column": 24, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, + "column": 2, + "line": 4, }, - "name": "U", - "range": Array [ - 24, - 25, - ], - "type": "Identifier", }, "range": Array [ - 24, - 25, + 47, + 59, ], - "type": "TSTypeParameter", + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", }, - ], - "range": Array [ - 20, - 26, - ], - "type": "TSTypeParameterDeclaration", + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 47, + 60, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 62, + ], + "type": "TSModuleBlock", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -41742,15 +42663,15 @@ Object { }, "range": Array [ 0, - 31, + 62, ], - "type": "ExportDefaultDeclaration", + "type": "TSModuleDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -41759,14 +42680,14 @@ Object { }, "range": Array [ 0, - 32, + 63, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 9, "line": 1, }, "start": Object { @@ -41776,169 +42697,223 @@ Object { }, "range": Array [ 0, - 6, + 9, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "namespace", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { - "column": 7, + "column": 10, "line": 1, }, }, "range": Array [ - 7, - 14, + 10, + 13, ], - "type": "Keyword", - "value": "default", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 15, "line": 1, }, "start": Object { - "column": 15, + "column": 14, "line": 1, }, }, "range": Array [ + 14, 15, - 20, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 20, - 21, + 18, + 30, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, ], "type": "Punctuator", - "value": "<", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 21, - "line": 1, + "column": 2, + "line": 3, }, }, "range": Array [ - 21, - 22, + 34, + 37, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, ], "type": "Identifier", - "value": "T", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 9, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 8, + "line": 3, }, }, "range": Array [ - 22, - 23, + 40, + 41, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 24, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 24, - 25, + 42, + 43, ], - "type": "Identifier", - "value": "U", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 12, + "line": 3, }, "start": Object { - "column": 25, - "line": 1, + "column": 11, + "line": 3, }, }, "range": Array [ - 25, - 26, + 43, + 44, ], "type": "Punctuator", - "value": ">", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 14, + "line": 4, }, "start": Object { - "column": 27, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 27, - 28, + 47, + 59, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 59, + 60, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 30, - 31, + 61, + 62, ], "type": "Punctuator", "value": "}", @@ -41948,122 +42923,32 @@ Object { } `; -exports[`typescript fixtures/basics/export-named-class-with-generic.src 1`] = ` +exports[`typescript fixtures/basics/export-as-namespace.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 24, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, + "id": Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 21, + "line": 1, }, "start": Object { - "column": 7, + "column": 20, "line": 1, }, }, + "name": "a", "range": Array [ - 7, - 24, + 20, + 21, ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - }, - "range": Array [ - 17, - 18, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 16, - 19, - ], - "type": "TSTypeParameterDeclaration", - }, + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { "column": 0, @@ -42072,17 +42957,15 @@ Object { }, "range": Array [ 0, - 24, + 22, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "TSNamespaceExportDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -42091,9 +42974,9 @@ Object { }, "range": Array [ 0, - 25, + 23, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { @@ -42116,7 +42999,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 9, "line": 1, }, "start": Object { @@ -42126,64 +43009,10 @@ Object { }, "range": Array [ 7, - 12, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - "value": "Foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, + 9, ], "type": "Identifier", - "value": "T", + "value": "as", }, Object { "loc": Object { @@ -42192,16 +43021,16 @@ Object { "line": 1, }, "start": Object { - "column": 18, + "column": 10, "line": 1, }, }, "range": Array [ - 18, + 10, 19, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "namespace", }, Object { "loc": Object { @@ -42218,183 +43047,58 @@ Object { 20, 21, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 21, + "line": 1, }, }, "range": Array [ - 23, - 24, + 21, + 22, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/export-named-class-with-multiple-generics.src 1`] = ` +exports[`typescript fixtures/basics/export-assignment.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 27, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, + "expression": Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 12, + "line": 1, }, "start": Object { - "column": 7, + "column": 9, "line": 1, }, }, + "name": "foo", "range": Array [ - 7, - 27, + 9, + 12, ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - }, - "range": Array [ - 17, - 18, - ], - "type": "TSTypeParameter", - }, - 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": "U", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, - "range": Array [ - 20, - 21, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 16, - 22, - ], - "type": "TSTypeParameterDeclaration", - }, + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 13, + "line": 1, }, "start": Object { "column": 0, @@ -42403,17 +43107,15 @@ Object { }, "range": Array [ 0, - 27, + 13, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "TSExportAssignment", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -42422,7 +43124,7 @@ Object { }, "range": Array [ 0, - 28, + 14, ], "sourceType": "module", "tokens": Array [ @@ -42447,7 +43149,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 1, }, "start": Object { @@ -42457,180 +43159,74 @@ Object { }, "range": Array [ 7, - 12, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - "value": "Foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - "value": "T", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, + 8, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 12, "line": 1, }, "start": Object { - "column": 20, + "column": 9, "line": 1, }, }, "range": Array [ - 20, - 21, + 9, + 12, ], "type": "Identifier", - "value": "U", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "Punctuator", - "value": ">", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 13, "line": 1, }, "start": Object { - "column": 23, + "column": 12, "line": 1, }, }, "range": Array [ - 23, - 24, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 26, - 27, + 12, + 13, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/export-named-enum.src 1`] = ` +exports[`typescript fixtures/basics/export-declare-const-named-enum.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { + "const": true, + "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 29, "line": 1, }, "start": Object { - "column": 12, + "column": 26, "line": 1, }, }, "name": "Foo", "range": Array [ - 12, - 15, + 26, + 29, ], "type": "Identifier", }, @@ -42659,8 +43255,8 @@ Object { }, "name": "foo", "range": Array [ - 22, - 25, + 36, + 39, ], "type": "Identifier", }, @@ -42676,8 +43272,8 @@ Object { }, }, "range": Array [ - 28, - 29, + 42, + 43, ], "raw": "1", "type": "Literal", @@ -42694,8 +43290,8 @@ Object { }, }, "range": Array [ - 22, - 29, + 36, + 43, ], "type": "TSEnumMember", }, @@ -42713,8 +43309,8 @@ Object { }, "name": "bar", "range": Array [ - 35, - 38, + 49, + 52, ], "type": "Identifier", }, @@ -42729,15 +43325,15 @@ Object { }, }, "range": Array [ - 35, - 38, + 49, + 52, ], "type": "TSEnumMember", }, ], "range": Array [ 7, - 40, + 54, ], "type": "TSEnumDeclaration", }, @@ -42753,7 +43349,7 @@ Object { }, "range": Array [ 0, - 40, + 54, ], "source": null, "specifiers": Array [], @@ -42762,8 +43358,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -42772,7 +43368,7 @@ Object { }, "range": Array [ 0, - 40, + 55, ], "sourceType": "module", "tokens": Array [ @@ -42797,7 +43393,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 14, "line": 1, }, "start": Object { @@ -42807,7 +43403,43 @@ Object { }, "range": Array [ 7, - 11, + 14, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, ], "type": "Keyword", "value": "enum", @@ -42815,17 +43447,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 29, "line": 1, }, "start": Object { - "column": 12, + "column": 26, "line": 1, }, }, "range": Array [ - 12, - 15, + 26, + 29, ], "type": "Identifier", "value": "Foo", @@ -42833,17 +43465,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 31, "line": 1, }, "start": Object { - "column": 16, + "column": 30, "line": 1, }, }, "range": Array [ - 16, - 17, + 30, + 31, ], "type": "Punctuator", "value": "{", @@ -42860,8 +43492,8 @@ Object { }, }, "range": Array [ - 22, - 25, + 36, + 39, ], "type": "Identifier", "value": "foo", @@ -42878,8 +43510,8 @@ Object { }, }, "range": Array [ - 26, - 27, + 40, + 41, ], "type": "Punctuator", "value": "=", @@ -42896,8 +43528,8 @@ Object { }, }, "range": Array [ - 28, - 29, + 42, + 43, ], "type": "Numeric", "value": "1", @@ -42914,8 +43546,8 @@ Object { }, }, "range": Array [ - 29, - 30, + 43, + 44, ], "type": "Punctuator", "value": ",", @@ -42932,8 +43564,8 @@ Object { }, }, "range": Array [ - 35, - 38, + 49, + 52, ], "type": "Identifier", "value": "bar", @@ -42950,8 +43582,8 @@ Object { }, }, "range": Array [ - 39, - 40, + 53, + 54, ], "type": "Punctuator", "value": "}", @@ -42961,102 +43593,141 @@ Object { } `; -exports[`typescript fixtures/basics/export-type-alias-declaration.src 1`] = ` +exports[`typescript fixtures/basics/export-declare-named-enum.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { + "declare": true, "id": Object { "loc": Object { "end": Object { - "column": 21, + "column": 23, "line": 1, }, "start": Object { - "column": 12, + "column": 20, "line": 1, }, }, - "name": "TestAlias", + "name": "Foo", "range": Array [ - 12, - 21, + 20, + 23, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 7, "line": 1, }, }, - "range": Array [ - 7, - 40, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 39, - ], - "type": "TSUnionType", - "types": Array [ - Object { + "members": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 4, + "line": 2, }, }, + "name": "foo", "range": Array [ - 24, 30, + 33, ], - "type": "TSStringKeyword", + "type": "Identifier", }, - Object { + "initializer": Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 33, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 33, - 39, + 36, + 37, ], - "type": "TSNumberKeyword", + "raw": "1", + "type": "Literal", + "value": 1, }, - ], - }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "TSEnumMember", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 43, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 7, + 48, + ], + "type": "TSEnumDeclaration", }, "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -43065,7 +43736,7 @@ Object { }, "range": Array [ 0, - 40, + 48, ], "source": null, "specifiers": Array [], @@ -43074,8 +43745,8 @@ Object { ], "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -43084,7 +43755,7 @@ Object { }, "range": Array [ 0, - 40, + 49, ], "sourceType": "module", "tokens": Array [ @@ -43109,7 +43780,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 14, "line": 1, }, "start": Object { @@ -43119,28 +43790,28 @@ Object { }, "range": Array [ 7, - 11, + 14, ], "type": "Identifier", - "value": "type", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 19, "line": 1, }, "start": Object { - "column": 12, + "column": 15, "line": 1, }, }, "range": Array [ - 12, - 21, + 15, + 19, ], - "type": "Identifier", - "value": "TestAlias", + "type": "Keyword", + "value": "enum", }, Object { "loc": Object { @@ -43149,21 +43820,21 @@ Object { "line": 1, }, "start": Object { - "column": 22, + "column": 20, "line": 1, }, }, "range": Array [ - 22, + 20, 23, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 25, "line": 1, }, "start": Object { @@ -43173,201 +43844,222 @@ Object { }, "range": Array [ 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ 30, + 33, ], "type": "Identifier", - "value": "string", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 31, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 31, - 32, + 34, + 35, ], "type": "Punctuator", - "value": "|", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 33, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 33, - 39, + 36, + 37, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, ], "type": "Identifier", - "value": "number", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 39, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 39, - 40, + 47, + 48, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/export-type-class-declaration.src 1`] = ` +exports[`typescript fixtures/basics/export-default-class-with-generic.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { - "id": Object { + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 12, + "column": 24, "line": 1, }, }, - "name": "TestClassProps", "range": Array [ - 12, - 26, + 24, + 28, ], - "type": "Identifier", + "type": "ClassBody", }, + "id": null, "loc": Object { "end": Object { - "column": 2, + "column": 1, "line": 3, }, "start": Object { - "column": 7, + "column": 15, "line": 1, }, }, "range": Array [ - 7, - 51, + 15, + 28, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 23, + "line": 1, }, "start": Object { - "column": 29, + "column": 20, "line": 1, }, }, - "members": Array [ + "params": Array [ Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "count", - "range": Array [ - 35, - 40, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 21, + "line": 1, }, }, - "range": Array [ - 35, - 48, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { + "name": Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 21, + "line": 1, }, }, + "name": "T", "range": Array [ - 40, - 48, + 21, + 22, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 42, - 48, - ], - "type": "TSNumberKeyword", - }, + "type": "Identifier", }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeParameter", }, ], "range": Array [ - 29, - 50, + 20, + 23, ], - "type": "TSTypeLiteral", + "type": "TSTypeParameterDeclaration", }, }, "loc": Object { "end": Object { - "column": 2, + "column": 1, "line": 3, }, "start": Object { @@ -43377,17 +44069,15 @@ Object { }, "range": Array [ 0, - 51, + 28, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "ExportDefaultDeclaration", }, ], "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -43396,7 +44086,7 @@ Object { }, "range": Array [ 0, - 51, + 29, ], "sourceType": "module", "tokens": Array [ @@ -43421,7 +44111,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 14, "line": 1, }, "start": Object { @@ -43431,118 +44121,100 @@ Object { }, "range": Array [ 7, - 11, + 14, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 20, "line": 1, }, "start": Object { - "column": 12, + "column": 15, "line": 1, }, }, "range": Array [ - 12, - 26, + 15, + 20, ], - "type": "Identifier", - "value": "TestClassProps", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 21, "line": 1, }, "start": Object { - "column": 27, + "column": 20, "line": 1, }, }, "range": Array [ - 27, - 28, + 20, + 21, ], "type": "Punctuator", - "value": "=", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 22, "line": 1, }, "start": Object { - "column": 29, + "column": 21, "line": 1, }, }, "range": Array [ - 29, - 30, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 35, - 40, + 21, + 22, ], "type": "Identifier", - "value": "count", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ - 40, - 41, + 22, + 23, ], "type": "Punctuator", - "value": ":", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 24, + "line": 1, }, }, "range": Array [ - 42, - 48, + 24, + 25, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { @@ -43556,81 +44228,65 @@ Object { }, }, "range": Array [ - 49, - 50, + 27, + 28, ], "type": "Punctuator", "value": "}", }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 3, - }, - "start": Object { - "column": 1, - "line": 3, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": ";", - }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/export-type-function-declaration.src 1`] = ` +exports[`typescript fixtures/basics/export-default-class-with-multiple-generics.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { - "id": Object { + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 12, + "column": 27, "line": 1, }, }, - "name": "TestCallback", "range": Array [ - 12, - 24, + 27, + 31, ], - "type": "Identifier", + "type": "ClassBody", }, + "id": null, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 7, + "column": 15, "line": 1, }, }, "range": Array [ - 7, - 47, + 15, + 31, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 46, + "column": 26, "line": 1, }, "start": Object { - "column": 27, + "column": 20, "line": 1, }, }, @@ -43638,101 +44294,85 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, + "column": 22, "line": 1, }, "start": Object { - "column": 28, + "column": 21, "line": 1, }, }, - "name": "a", - "range": Array [ - 28, - 37, - ], - "type": "Identifier", - "typeAnnotation": Object { + "name": Object { "loc": Object { "end": Object { - "column": 37, + "column": 22, "line": 1, }, "start": Object { - "column": 29, + "column": 21, "line": 1, }, }, + "name": "T", "range": Array [ - 29, - 37, + 21, + 22, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 37, - ], - "type": "TSNumberKeyword", - }, - }, - }, - ], - "range": Array [ - 27, - 46, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, + "type": "Identifier", }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeParameter", }, - "range": Array [ - 39, - 46, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + Object { "loc": Object { "end": Object { - "column": 46, + "column": 25, "line": 1, }, "start": Object { - "column": 42, + "column": 24, "line": 1, }, }, + "name": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + }, "range": Array [ - 42, - 46, + 24, + 25, ], - "type": "TSVoidKeyword", + "type": "TSTypeParameter", }, - }, - "type": "TSFunctionType", + ], + "range": Array [ + 20, + 26, + ], + "type": "TSTypeParameterDeclaration", }, }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -43741,17 +44381,15 @@ Object { }, "range": Array [ 0, - 47, + 31, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "ExportDefaultDeclaration", }, ], "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -43760,7 +44398,7 @@ Object { }, "range": Array [ 0, - 47, + 32, ], "sourceType": "module", "tokens": Array [ @@ -43785,7 +44423,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 14, "line": 1, }, "start": Object { @@ -43795,28 +44433,100 @@ Object { }, "range": Array [ 7, - 11, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "class", + }, + 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, ], "type": "Identifier", - "value": "type", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 23, "line": 1, }, "start": Object { - "column": 12, + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, "line": 1, }, }, "range": Array [ - 12, 24, + 25, ], "type": "Identifier", - "value": "TestCallback", + "value": "U", }, Object { "loc": Object { @@ -43834,7 +44544,7 @@ Object { 26, ], "type": "Punctuator", - "value": "=", + "value": ">", }, Object { "loc": Object { @@ -43852,367 +44562,477 @@ Object { 28, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-named-class-with-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 24, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "range": Array [ + 17, + 18, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 16, + 19, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, "line": 1, }, "start": Object { - "column": 28, + "column": 0, "line": 1, }, }, "range": Array [ - 28, - 29, + 0, + 6, ], - "type": "Identifier", - "value": "a", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 12, "line": 1, }, "start": Object { - "column": 29, + "column": 7, "line": 1, }, }, "range": Array [ - 29, - 30, + 7, + 12, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 16, "line": 1, }, "start": Object { - "column": 31, + "column": 13, "line": 1, }, }, "range": Array [ - 31, - 37, + 13, + 16, ], "type": "Identifier", - "value": "number", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 17, "line": 1, }, "start": Object { - "column": 37, + "column": 16, "line": 1, }, }, "range": Array [ - 37, - 38, + 16, + 17, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 18, "line": 1, }, "start": Object { - "column": 39, + "column": 17, "line": 1, }, }, "range": Array [ - 39, - 41, + 17, + 18, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 19, "line": 1, }, "start": Object { - "column": 42, + "column": 18, "line": 1, }, }, "range": Array [ - 42, - 46, + 18, + 19, ], - "type": "Keyword", - "value": "void", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 47, + "column": 21, "line": 1, }, "start": Object { - "column": 46, + "column": 20, "line": 1, }, }, "range": Array [ - 46, - 47, + 20, + 21, ], "type": "Punctuator", - "value": ";", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-anonymus-with-type-parameters.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-named-class-with-multiple-generics.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 1, }, - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", }, - "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", - }, - ], + "range": Array [ + 23, + 27, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 27, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 34, + "column": 17, "line": 1, }, }, - "range": Array [ - 34, - 49, - ], - "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 { + "name": Object { "loc": Object { "end": Object { - "column": 32, + "column": 18, "line": 1, }, "start": Object { - "column": 23, + "column": 17, "line": 1, }, }, - "name": "a", + "name": "T", "range": Array [ - 23, - 32, + 17, + 18, ], "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 { + "range": Array [ + 17, + 18, + ], + "type": "TSTypeParameter", + }, + Object { "loc": Object { "end": Object { - "column": 22, + "column": 21, "line": 1, }, "start": Object { - "column": 19, + "column": 20, "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, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", + "start": Object { + "column": 20, + "line": 1, }, - "range": Array [ - 20, - 21, - ], - "type": "TSTypeParameter", }, - ], + "name": "U", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, "range": Array [ - 19, - 22, + 20, + 21, ], - "type": "TSTypeParameterDeclaration", - }, - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 1, + "type": "TSTypeParameter", }, - }, + ], "range": Array [ - 4, - 49, + 16, + 22, ], - "type": "VariableDeclarator", + "type": "TSTypeParameterDeclaration", }, - ], - "kind": "var", + }, "loc": Object { "end": Object { - "column": 2, + "column": 1, "line": 3, }, "start": Object { @@ -44222,9 +45042,11 @@ Object { }, "range": Array [ 0, - 50, + 27, ], - "type": "VariableDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { @@ -44239,14 +45061,14 @@ Object { }, "range": Array [ 0, - 51, + 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 6, "line": 1, }, "start": Object { @@ -44256,46 +45078,64 @@ Object { }, "range": Array [ 0, - 3, + 6, ], "type": "Keyword", - "value": "var", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 12, "line": 1, }, "start": Object { - "column": 4, + "column": 7, "line": 1, }, }, "range": Array [ - 4, 7, + 12, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, ], "type": "Identifier", - "value": "obj", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 17, "line": 1, }, "start": Object { - "column": 8, + "column": 16, "line": 1, }, }, "range": Array [ - 8, - 9, + 16, + 17, ], "type": "Punctuator", - "value": "=", + "value": "<", }, Object { "loc": Object { @@ -44304,34 +45144,34 @@ Object { "line": 1, }, "start": Object { - "column": 10, + "column": 17, "line": 1, }, }, "range": Array [ - 10, + 17, 18, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 19, "line": 1, }, "start": Object { - "column": 19, + "column": 18, "line": 1, }, }, "range": Array [ + 18, 19, - 20, ], "type": "Punctuator", - "value": "<", + "value": ",", }, Object { "loc": Object { @@ -44349,7 +45189,7 @@ Object { 21, ], "type": "Identifier", - "value": "T", + "value": "U", }, Object { "loc": Object { @@ -44372,107 +45212,277 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 24, "line": 1, }, "start": Object { - "column": 22, + "column": 23, "line": 1, }, }, "range": Array [ - 22, 23, + 24, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 23, + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-named-enum.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "members": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 29, + ], + "type": "TSEnumMember", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 7, + 40, + ], + "type": "TSEnumDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, "line": 1, }, }, "range": Array [ - 23, - 24, + 0, + 40, ], - "type": "Identifier", - "value": "a", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 25, + "column": 6, "line": 1, }, "start": Object { - "column": 24, + "column": 0, "line": 1, }, }, "range": Array [ - 24, - 25, + 0, + 6, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 11, "line": 1, }, "start": Object { - "column": 26, + "column": 7, "line": 1, }, }, "range": Array [ - 26, - 32, + 7, + 11, ], - "type": "Identifier", - "value": "string", + "type": "Keyword", + "value": "enum", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 15, "line": 1, }, "start": Object { - "column": 32, + "column": 12, "line": 1, }, }, "range": Array [ - 32, - 33, + 12, + 15, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 17, "line": 1, }, "start": Object { - "column": 34, + "column": 16, "line": 1, }, }, "range": Array [ - 34, - 35, + 16, + 17, ], "type": "Punctuator", "value": "{", @@ -44480,38 +45490,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 7, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ - 38, - 44, + 22, + 25, ], - "type": "Keyword", - "value": "return", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 9, "line": 2, }, "start": Object { - "column": 9, + "column": 8, "line": 2, }, }, "range": Array [ - 45, - 46, + 26, + 27, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { @@ -44525,173 +45535,167 @@ Object { }, }, "range": Array [ - 46, - 47, + 28, + 29, ], - "type": "Punctuator", - "value": ";", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 12, + "line": 2, }, "start": Object { - "column": 0, - "line": 3, + "column": 11, + "line": 2, }, }, "range": Array [ - 48, - 49, + 29, + 30, ], "type": "Punctuator", - "value": "}", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 7, "line": 3, }, "start": Object { - "column": 1, + "column": 4, "line": 3, }, }, "range": Array [ - 49, - 50, + 35, + 38, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 39, + 40, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/function-anynomus-with-return-type.src 1`] = ` +exports[`typescript fixtures/basics/export-type-alias-declaration.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "declaration": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, }, - "name": "obj", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", }, - "init": Object { - "async": false, - "body": Object { - "body": Array [], + "name": "TestAlias", + "range": Array [ + 12, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 40, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 39, + ], + "type": "TSUnionType", + "types": Array [ + Object { "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 30, + "line": 1, }, "start": Object { - "column": 28, + "column": 24, "line": 1, }, }, "range": Array [ - 28, - 31, + 24, + 30, ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "type": "TSStringKeyword", }, - "params": Array [], - "range": Array [ - 10, - 31, - ], - "returnType": Object { + Object { "loc": Object { "end": Object { - "column": 27, + "column": 39, "line": 1, }, "start": Object { - "column": 21, + "column": 33, "line": 1, }, }, "range": Array [ - 21, - 27, + 33, + 39, ], - "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, + "type": "TSNumberKeyword", }, - }, - "range": Array [ - 4, - 31, ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + }, "loc": Object { "end": Object { - "column": 2, - "line": 2, + "column": 40, + "line": 1, }, "start": Object { "column": 0, @@ -44700,15 +45704,17 @@ Object { }, "range": Array [ 0, - 32, + 40, ], - "type": "VariableDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 3, + "column": 40, + "line": 1, }, "start": Object { "column": 0, @@ -44717,14 +45723,14 @@ Object { }, "range": Array [ 0, - 33, + 40, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 6, "line": 1, }, "start": Object { @@ -44734,187 +45740,133 @@ Object { }, "range": Array [ 0, - 3, + 6, ], "type": "Keyword", - "value": "var", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 11, "line": 1, }, "start": Object { - "column": 4, + "column": 7, "line": 1, }, }, "range": Array [ - 4, 7, + 11, ], "type": "Identifier", - "value": "obj", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": "=", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 21, "line": 1, }, "start": Object { - "column": 10, + "column": 12, "line": 1, }, }, "range": Array [ - 10, - 18, + 12, + 21, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "TestAlias", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 23, "line": 1, }, "start": Object { - "column": 19, + "column": 22, "line": 1, }, }, "range": Array [ - 19, - 20, + 22, + 23, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 30, "line": 1, }, "start": Object { - "column": 20, + "column": 24, "line": 1, }, }, "range": Array [ - 20, - 21, + 24, + 30, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 32, "line": 1, }, "start": Object { - "column": 21, + "column": 31, "line": 1, }, }, "range": Array [ - 21, - 22, + 31, + 32, ], "type": "Punctuator", - "value": ":", + "value": "|", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 39, "line": 1, }, "start": Object { - "column": 23, + "column": 33, "line": 1, }, }, "range": Array [ - 23, - 27, + 33, + 39, ], - "type": "Keyword", - "value": "void", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 40, "line": 1, }, "start": Object { - "column": 28, + "column": 39, "line": 1, }, }, "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 2, - }, - "start": Object { - "column": 1, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, + 39, + 40, ], "type": "Punctuator", "value": ";", @@ -44924,565 +45876,147 @@ Object { } `; -exports[`typescript fixtures/basics/function-overloads.src 1`] = ` +exports[`typescript fixtures/basics/export-type-class-declaration.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { - "async": false, - "expression": false, - "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 17, + "column": 26, "line": 1, }, "start": Object { - "column": 16, + "column": 12, "line": 1, }, }, - "name": "f", + "name": "TestClassProps", "range": Array [ - 16, - 17, + 12, + 26, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 2, + "line": 3, }, "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, + 51, ], - "returnType": Object { + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 28, + "column": 29, "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 { + "members": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 27, + "column": 9, "line": 2, }, "start": Object { - "column": 21, + "column": 4, "line": 2, }, }, + "name": "count", "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, + 35, + 40, ], "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, + "column": 17, + "line": 2, }, "start": Object { - "column": 19, - "line": 3, + "column": 4, + "line": 2, }, }, "range": Array [ - 95, - 112, + 35, + 48, ], - "type": "TSTypeAnnotation", + "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 36, - "line": 3, + "column": 17, + "line": 2, }, "start": Object { - "column": 21, - "line": 3, + "column": 9, + "line": 2, }, }, "range": Array [ - 97, - 112, + 40, + 48, ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, }, - "range": Array [ - 97, - 103, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, + "start": Object { + "column": 11, + "line": 2, }, - "range": Array [ - 106, - 112, - ], - "type": "TSNumberKeyword", }, - ], + "range": Array [ + 42, + 48, + ], + "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, + 29, + 50, ], - "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": "TSTypeLiteral", }, - "type": "FunctionDeclaration", }, "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 2, + "line": 3, }, "start": Object { "column": 0, - "line": 3, + "line": 1, }, }, "range": Array [ - 76, - 146, + 0, + 51, ], "source": null, "specifiers": Array [], @@ -45491,8 +46025,8 @@ Object { ], "loc": Object { "end": Object { - "column": 0, - "line": 6, + "column": 2, + "line": 3, }, "start": Object { "column": 0, @@ -45501,7 +46035,7 @@ Object { }, "range": Array [ 0, - 147, + 51, ], "sourceType": "module", "tokens": Array [ @@ -45526,7 +46060,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 1, }, "start": Object { @@ -45536,187 +46070,353 @@ Object { }, "range": Array [ 7, - 15, + 11, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 26, "line": 1, }, "start": Object { - "column": 16, + "column": 12, "line": 1, }, }, "range": Array [ - 16, - 17, + 12, + 26, ], "type": "Identifier", - "value": "f", + "value": "TestClassProps", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 28, "line": 1, }, "start": Object { - "column": 17, + "column": 27, "line": 1, }, }, "range": Array [ - 17, - 18, + 27, + 28, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 30, "line": 1, }, "start": Object { - "column": 18, + "column": 29, "line": 1, }, }, "range": Array [ - 18, - 19, + 29, + 30, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 19, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 19, - 20, + 35, + 40, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "count", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 21, - 27, + 40, + 41, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 27, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 27, - 28, + 42, + 48, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 28, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 28, - 29, + 49, + 50, ], "type": "Punctuator", - "value": ":", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 2, + "line": 3, }, "start": Object { - "column": 30, - "line": 1, + "column": 1, + "line": 3, }, }, "range": Array [ - 30, - 36, + 50, + 51, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-type-function-declaration.src 1`] = ` +Object { + "body": Array [ Object { + "declaration": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "TestCallback", + "range": Array [ + 12, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 47, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 28, + 37, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 27, + 46, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSFunctionType", + }, + }, "loc": Object { "end": Object { - "column": 37, + "column": 47, "line": 1, }, "start": Object { - "column": 36, + "column": 0, "line": 1, }, }, "range": Array [ - 36, - 37, + 0, + 47, ], - "type": "Punctuator", - "value": ";", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { "column": 6, - "line": 2, + "line": 1, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, "range": Array [ - 38, - 44, + 0, + 6, ], "type": "Keyword", "value": "export", @@ -45724,143 +46424,107 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { "column": 7, - "line": 2, + "line": 1, }, }, "range": Array [ - 45, - 53, + 7, + 11, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "type", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 24, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 12, + "line": 1, }, }, "range": Array [ - 54, - 55, + 12, + 24, ], "type": "Identifier", - "value": "f", + "value": "TestCallback", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 26, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 25, + "line": 1, }, }, "range": Array [ - 55, - 56, + 25, + 26, ], "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", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 27, + "line": 1, }, }, "range": Array [ - 57, - 58, + 27, + 28, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 21, - "line": 2, + "column": 28, + "line": 1, }, }, "range": Array [ - 59, - 65, + 28, + 29, ], "type": "Identifier", - "value": "string", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 30, + "line": 1, }, "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, + "line": 1, }, }, "range": Array [ - 66, - 67, + 29, + 30, ], "type": "Punctuator", "value": ":", @@ -45868,305 +46532,586 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 37, + "line": 1, }, "start": Object { - "column": 30, - "line": 2, + "column": 31, + "line": 1, }, }, "range": Array [ - 68, - 74, + 31, + 37, ], "type": "Identifier", - "value": "string", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 38, + "line": 1, }, "start": Object { - "column": 36, - "line": 2, + "column": 37, + "line": 1, }, }, "range": Array [ - 74, - 75, + 37, + 38, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 41, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 39, + "line": 1, }, }, "range": Array [ - 76, - 82, + 39, + 41, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 46, + "line": 1, }, "start": Object { - "column": 7, - "line": 3, + "column": 42, + "line": 1, }, }, "range": Array [ - 83, - 91, + 42, + 46, ], "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", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 47, + "line": 1, }, "start": Object { - "column": 17, - "line": 3, + "column": 46, + "line": 1, }, }, "range": Array [ - 93, - 94, + 46, + 47, ], "type": "Punctuator", - "value": "(", + "value": ";", }, - Object { - "loc": Object { + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-anonymus-with-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "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 [ + 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": 1, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 49, + ], + "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": 32, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 23, + 32, + ], + "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", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 49, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { "end": Object { - "column": 19, + "column": 2, "line": 3, }, "start": Object { - "column": 18, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 94, - 95, + 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": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, ], "type": "Identifier", - "value": "x", + "value": "obj", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 3, + "column": 9, + "line": 1, }, "start": Object { - "column": 19, - "line": 3, + "column": 8, + "line": 1, }, }, "range": Array [ - 95, - 96, + 8, + 9, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 21, - "line": 3, + "column": 10, + "line": 1, }, }, "range": Array [ - 97, - 103, + 10, + 18, ], - "type": "Identifier", - "value": "string", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 3, + "column": 20, + "line": 1, }, "start": Object { - "column": 28, - "line": 3, + "column": 19, + "line": 1, }, }, "range": Array [ - 104, - 105, + 19, + 20, ], "type": "Punctuator", - "value": "|", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 3, + "column": 21, + "line": 1, }, "start": Object { - "column": 30, - "line": 3, + "column": 20, + "line": 1, }, }, "range": Array [ - 106, - 112, + 20, + 21, ], "type": "Identifier", - "value": "number", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 36, - "line": 3, + "column": 21, + "line": 1, }, }, "range": Array [ - 112, - 113, + 21, + 22, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 3, + "column": 23, + "line": 1, }, "start": Object { - "column": 37, - "line": 3, + "column": 22, + "line": 1, }, }, "range": Array [ - 113, - 114, + 22, + 23, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 45, - "line": 3, + "column": 24, + "line": 1, }, "start": Object { - "column": 39, - "line": 3, + "column": 23, + "line": 1, }, }, "range": Array [ - 115, - 121, + 23, + 24, ], "type": "Identifier", - "value": "string", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 46, - "line": 3, + "column": 24, + "line": 1, }, }, "range": Array [ - 122, - 123, + 24, + 25, ], "type": "Punctuator", - "value": "|", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 54, - "line": 3, + "column": 32, + "line": 1, }, "start": Object { - "column": 48, - "line": 3, + "column": 26, + "line": 1, }, }, "range": Array [ - 124, - 130, + 26, + 32, ], "type": "Identifier", - "value": "number", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 56, - "line": 3, + "column": 33, + "line": 1, }, "start": Object { - "column": 55, - "line": 3, + "column": 32, + "line": 1, }, }, "range": Array [ - 131, - 132, + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, ], "type": "Punctuator", "value": "{", @@ -46175,16 +47120,16 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 4, + "line": 2, }, "start": Object { "column": 2, - "line": 4, + "line": 2, }, }, "range": Array [ - 135, - 141, + 38, + 44, ], "type": "Keyword", "value": "return", @@ -46193,34 +47138,34 @@ Object { "loc": Object { "end": Object { "column": 10, - "line": 4, + "line": 2, }, "start": Object { "column": 9, - "line": 4, + "line": 2, }, }, "range": Array [ - 142, - 143, + 45, + 46, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { "column": 11, - "line": 4, + "line": 2, }, "start": Object { "column": 10, - "line": 4, + "line": 2, }, }, "range": Array [ - 143, - 144, + 46, + 47, ], "type": "Punctuator", "value": ";", @@ -46229,162 +47174,180 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, - "line": 5, + "line": 3, }, }, "range": Array [ - 145, - 146, + 48, + 49, ], "type": "Punctuator", "value": "}", }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/function-with-await.src 1`] = ` +exports[`typescript fixtures/basics/function-anynomus-with-return-type.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", + "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": 16, + "column": 1, "line": 2, }, "start": Object { - "column": 4, - "line": 2, + "column": 28, + "line": 1, }, }, "range": Array [ - 34, - 46, + 28, + 31, ], - "type": "AwaitExpression", + "type": "BlockStatement", }, + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 17, + "column": 1, "line": 2, }, "start": Object { - "column": 4, - "line": 2, + "column": 10, + "line": 1, }, }, + "params": Array [], "range": Array [ - 34, - 47, + 10, + 31, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 49, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, + "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", }, - }, - "name": "hope", - "range": Array [ - 15, - 19, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 1, + "line": 2, }, "start": Object { - "column": 20, + "column": 4, "line": 1, }, }, - "name": "future", "range": Array [ - 20, - 26, + 4, + 31, ], - "type": "Identifier", + "type": "VariableDeclarator", }, ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ 0, - 49, + 32, ], - "type": "FunctionDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -46393,14 +47356,14 @@ Object { }, "range": Array [ 0, - 50, + 33, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -46410,97 +47373,97 @@ Object { }, "range": Array [ 0, - 5, + 3, ], - "type": "Identifier", - "value": "async", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 7, "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, - 14, + 4, + 7, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "obj", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { - "column": 15, + "column": 8, "line": 1, }, }, "range": Array [ - 15, - 19, + 8, + 9, ], - "type": "Identifier", - "value": "hope", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 18, "line": 1, }, "start": Object { - "column": 19, + "column": 10, "line": 1, }, }, "range": Array [ - 19, - 20, + 10, + 18, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 20, "line": 1, }, "start": Object { - "column": 20, + "column": 19, "line": 1, }, }, "range": Array [ + 19, 20, - 26, ], - "type": "Identifier", - "value": "future", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 21, "line": 1, }, "start": Object { - "column": 26, + "column": 20, "line": 1, }, }, "range": Array [ - 26, - 27, + 20, + 21, ], "type": "Punctuator", "value": ")", @@ -46508,245 +47471,156 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 1, }, "start": Object { - "column": 28, + "column": 21, "line": 1, }, }, "range": Array [ - 28, - 29, + 21, + 22, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 27, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 23, + "line": 1, }, }, "range": Array [ - 34, - 39, + 23, + 27, ], - "type": "Identifier", - "value": "await", + "type": "Keyword", + "value": "void", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 28, + "line": 1, }, }, "range": Array [ - 40, - 46, + 28, + 29, ], - "type": "Identifier", - "value": "future", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 1, "line": 2, }, "start": Object { - "column": 16, + "column": 0, "line": 2, }, }, "range": Array [ - 46, - 47, + 30, + 31, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 2, + "line": 2, }, "start": Object { - "column": 0, - "line": 3, + "column": 1, + "line": 2, }, }, "range": Array [ - 48, - 49, + 31, + 32, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/function-with-object-type-with-optional-properties.src 1`] = ` +exports[`typescript fixtures/basics/function-overloads.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 47, - "line": 1, + "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", }, - "range": Array [ - 47, - 51, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 37, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, }, - "method": false, - "range": Array [ - 14, - 17, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", + "start": Object { + "column": 18, + "line": 1, }, }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, - "kind": "init", + "name": "x", + "range": Array [ + 18, + 27, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, + "column": 27, "line": 1, }, "start": Object { @@ -46754,195 +47628,510 @@ Object { "line": 1, }, }, - "method": false, "range": Array [ 19, - 22, + 27, ], - "shorthand": true, - "type": "Property", - "value": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, + "column": 27, "line": 1, }, "start": Object { - "column": 19, + "column": 21, "line": 1, }, }, - "name": "baz", "range": Array [ - 19, - 22, + 21, + 27, ], - "type": "Identifier", + "type": "TSNumberKeyword", }, }, - ], - "range": Array [ - 13, - 45, - ], - "type": "ObjectPattern", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 23, + }, + ], + "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 [ - 23, - 45, + 30, + 36, ], - "type": "TSTypeAnnotation", + "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": 45, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 25, - "line": 1, + "column": 19, + "line": 2, }, }, - "members": Array [ - Object { - "computed": false, - "key": Object { + "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": 29, - "line": 1, + "column": 27, + "line": 3, }, "start": Object { - "column": 26, - "line": 1, + "column": 21, + "line": 3, }, }, - "name": "bar", "range": Array [ - 26, - 29, + 97, + 103, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, + "type": "TSStringKeyword", }, - "optional": true, - "range": Array [ - 26, - 39, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { + Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 36, + "line": 3, }, "start": Object { "column": 30, - "line": 1, + "line": 3, }, }, "range": Array [ - 30, - 38, + 106, + 112, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TSStringKeyword", - }, + "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, }, }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 40, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 40, - 43, - ], - "type": "Identifier", + "range": Array [ + 115, + 121, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, }, - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 40, - "line": 1, - }, + "start": Object { + "column": 48, + "line": 3, }, - "optional": true, - "range": Array [ - 40, - 44, - ], - "type": "TSPropertySignature", }, - ], - "range": Array [ - 25, - 45, - ], - "type": "TSTypeLiteral", - }, + "range": Array [ + 124, + 130, + ], + "type": "TSNumberKeyword", + }, + ], }, }, - ], + "type": "FunctionDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, "range": Array [ - 0, - 51, + 76, + 146, ], - "type": "FunctionDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 6, }, "start": Object { "column": 0, @@ -46951,14 +48140,14 @@ Object { }, "range": Array [ 0, - 52, + 147, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -46968,151 +48157,151 @@ Object { }, "range": Array [ 0, - 8, + 6, ], "type": "Keyword", - "value": "function", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 15, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, "range": Array [ - 9, - 12, + 7, + 15, ], - "type": "Identifier", - "value": "foo", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 17, "line": 1, }, "start": Object { - "column": 12, + "column": 16, "line": 1, }, }, "range": Array [ - 12, - 13, + 16, + 17, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 18, "line": 1, }, "start": Object { - "column": 13, + "column": 17, "line": 1, }, }, "range": Array [ - 13, - 14, + 17, + 18, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 19, "line": 1, }, "start": Object { - "column": 14, + "column": 18, "line": 1, }, }, "range": Array [ - 14, - 17, + 18, + 19, ], "type": "Identifier", - "value": "bar", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 20, "line": 1, }, "start": Object { - "column": 17, + "column": 19, "line": 1, }, }, "range": Array [ - 17, - 18, + 19, + 20, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 27, "line": 1, }, "start": Object { - "column": 19, + "column": 21, "line": 1, }, }, "range": Array [ - 19, - 22, + 21, + 27, ], "type": "Identifier", - "value": "baz", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 28, "line": 1, }, "start": Object { - "column": 22, + "column": 27, "line": 1, }, }, "range": Array [ - 22, - 23, + 27, + 28, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 29, "line": 1, }, "start": Object { - "column": 23, + "column": 28, "line": 1, }, }, "range": Array [ - 23, - 24, + 28, + 29, ], "type": "Punctuator", "value": ":", @@ -47120,71 +48309,143 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 36, "line": 1, }, "start": Object { - "column": 25, + "column": 30, "line": 1, }, }, "range": Array [ - 25, - 26, + 30, + 36, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 37, "line": 1, }, "start": Object { - "column": 26, + "column": 36, "line": 1, }, }, "range": Array [ - 26, - 29, + 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": "bar", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 29, - 30, + 55, + 56, ], "type": "Punctuator", - "value": "?", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 30, - "line": 1, + "column": 18, + "line": 2, }, }, "range": Array [ - 30, - 31, + 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": ":", @@ -47192,17 +48453,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 32, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 32, - 38, + 59, + 65, ], "type": "Identifier", "value": "string", @@ -47210,211 +48471,851 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 28, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 27, + "line": 2, }, }, "range": Array [ - 38, - 39, + 65, + 66, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 40, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 40, - 43, + 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": "baz", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 37, + "line": 2, }, "start": Object { - "column": 43, - "line": 1, + "column": 36, + "line": 2, }, }, "range": Array [ - 43, - 44, + 74, + 75, ], "type": "Punctuator", - "value": "?", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 6, + "line": 3, }, "start": Object { - "column": 44, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 44, - 45, + 76, + 82, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 46, - "line": 1, + "column": 15, + "line": 3, }, "start": Object { - "column": 45, - "line": 1, + "column": 7, + "line": 3, }, }, "range": Array [ - 45, - 46, + 83, + 91, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 17, + "line": 3, }, "start": Object { - "column": 47, - "line": 1, + "column": 16, + "line": 3, }, }, "range": Array [ - 47, - 48, + 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": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 19, "line": 3, }, "start": Object { - "column": 0, + "column": 18, "line": 3, }, }, "range": Array [ - 50, - 51, + 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": "}", + "value": ":", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 45, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, }, - "range": Array [ - 45, - 49, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "range": Array [ + 97, + 103, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, }, - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": "|", + }, + Object { "loc": Object { "end": Object { - "column": 1, + "column": 36, "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 30, + "line": 3, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, + "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, + "line": 1, + }, + }, + "range": Array [ + 28, + 49, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "hope", + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "future", + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 49, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "value": "hope", + }, + 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": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + "value": "future", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "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": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "future", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-object-type-with-optional-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, }, }, "name": "bar", @@ -47521,13 +49422,13 @@ Object { ], "range": Array [ 13, - 43, + 45, ], "type": "ObjectPattern", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 43, + "column": 45, "line": 1, }, "start": Object { @@ -47537,13 +49438,13 @@ Object { }, "range": Array [ 23, - 43, + 45, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 43, + "column": 45, "line": 1, }, "start": Object { @@ -47574,7 +49475,7 @@ Object { }, "loc": Object { "end": Object { - "column": 38, + "column": 39, "line": 1, }, "start": Object { @@ -47582,41 +49483,42 @@ Object { "line": 1, }, }, + "optional": true, "range": Array [ 26, - 38, + 39, ], "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 38, "line": 1, }, "start": Object { - "column": 29, + "column": 30, "line": 1, }, }, "range": Array [ - 29, - 37, + 30, + 38, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 38, "line": 1, }, "start": Object { - "column": 31, + "column": 32, "line": 1, }, }, "range": Array [ - 31, - 37, + 32, + 38, ], "type": "TSStringKeyword", }, @@ -47627,41 +49529,42 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 42, + "column": 43, "line": 1, }, "start": Object { - "column": 39, + "column": 40, "line": 1, }, }, "name": "baz", "range": Array [ - 39, - 42, + 40, + 43, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 42, + "column": 44, "line": 1, }, "start": Object { - "column": 39, + "column": 40, "line": 1, }, }, + "optional": true, "range": Array [ - 39, - 42, + 40, + 44, ], "type": "TSPropertySignature", }, ], "range": Array [ 25, - 43, + 45, ], "type": "TSTypeLiteral", }, @@ -47670,7 +49573,7 @@ Object { ], "range": Array [ 0, - 49, + 51, ], "type": "FunctionDeclaration", }, @@ -47687,7 +49590,7 @@ Object { }, "range": Array [ 0, - 50, + 52, ], "sourceType": "script", "tokens": Array [ @@ -47905,22 +49808,40 @@ Object { 30, ], "type": "Punctuator", - "value": ":", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 31, "line": 1, }, "start": Object { - "column": 31, + "column": 30, "line": 1, }, }, "range": Array [ + 30, 31, - 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, ], "type": "Identifier", "value": "string", @@ -47928,17 +49849,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 39, "line": 1, }, "start": Object { - "column": 37, + "column": 38, "line": 1, }, }, "range": Array [ - 37, 38, + 39, ], "type": "Punctuator", "value": ",", @@ -47946,17 +49867,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 43, "line": 1, }, "start": Object { - "column": 39, + "column": 40, "line": 1, }, }, "range": Array [ - 39, - 42, + 40, + 43, ], "type": "Identifier", "value": "baz", @@ -47964,38 +49885,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, + "column": 44, "line": 1, }, "start": Object { - "column": 42, + "column": 43, "line": 1, }, }, "range": Array [ - 42, 43, + 44, ], "type": "Punctuator", - "value": "}", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 44, + "column": 45, "line": 1, }, "start": Object { - "column": 43, + "column": 44, "line": 1, }, }, "range": Array [ - 43, 44, + 45, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { @@ -48013,6 +49934,24 @@ Object { 46, ], "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", "value": "{", }, Object { @@ -48027,8 +49966,8 @@ Object { }, }, "range": Array [ - 48, - 49, + 50, + 51, ], "type": "Punctuator", "value": "}", @@ -48038,62 +49977,26 @@ Object { } `; -exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = ` +exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = ` Object { "body": Array [ Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "b", - "range": Array [ - 36, - 37, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 29, - 38, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { "column": 1, "line": 3, }, "start": Object { - "column": 23, + "column": 45, "line": 1, }, }, "range": Array [ - 23, - 40, + 45, + 49, ], "type": "BlockStatement", }, @@ -48102,7 +50005,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { @@ -48110,10 +50013,10 @@ Object { "line": 1, }, }, - "name": "a", + "name": "foo", "range": Array [ 9, - 10, + 12, ], "type": "Identifier", }, @@ -48131,177 +50034,913 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 43, "line": 1, }, "start": Object { - "column": 14, + "column": 13, "line": 1, }, }, - "name": "b", - "range": Array [ - 14, - 18, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", }, - }, - "range": Array [ - 15, - 18, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "kind": "init", "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { - "column": 17, + "column": 14, "line": 1, }, }, + "method": false, "range": Array [ + 14, 17, - 18, ], - "type": "TSTypeReference", - "typeName": Object { + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { - "column": 17, + "column": 14, "line": 1, }, }, - "name": "X", + "name": "bar", "range": Array [ + 14, 17, - 18, ], "type": "Identifier", }, }, - }, - }, - ], - "range": Array [ - 0, - 40, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 22, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 19, + 22, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, }, - }, + ], "range": Array [ - 21, - 22, + 13, + 43, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "ObjectPattern", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, + "column": 43, "line": 1, }, "start": Object { - "column": 21, + "column": 23, "line": 1, }, }, - "name": "X", "range": Array [ - 21, - 22, + 23, + 43, ], - "type": "Identifier", - }, - }, - }, - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 12, + "column": 43, "line": 1, }, "start": Object { - "column": 11, + "column": 25, "line": 1, }, }, - "name": "X", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", - }, - "range": Array [ - 11, - 12, - ], - "type": "TSTypeParameter", + "members": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 38, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "TSPropertySignature", + }, + ], + "range": Array [ + 25, + 43, + ], + "type": "TSTypeLiteral", + }, + }, + }, + ], + "range": Array [ + 0, + 49, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "bar", + }, + 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": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 29, + 38, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 40, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 40, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + }, + }, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "range": Array [ + 11, + 12, + ], + "type": "TSTypeParameter", }, ], "range": Array [ @@ -62917,1249 +65556,9180 @@ Object { "column": 2, "line": 14, }, - }, + }, + "range": Array [ + 147, + 151, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 14, + }, + "start": Object { + "column": 6, + "line": 14, + }, + }, + "range": Array [ + 151, + 152, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 15, + }, + "start": Object { + "column": 2, + "line": 15, + }, + }, + "range": Array [ + 155, + 160, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 15, + }, + "start": Object { + "column": 7, + "line": 15, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 16, + }, + "start": Object { + "column": 2, + "line": 16, + }, + }, + "range": Array [ + 164, + 166, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 16, + }, + "start": Object { + "column": 4, + "line": 16, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 17, + }, + "start": Object { + "column": 0, + "line": 17, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 17, + }, + "start": Object { + "column": 2, + "line": 17, + }, + }, + "range": Array [ + 170, + 174, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 17, + }, + "start": Object { + "column": 7, + "line": 17, + }, + }, + "range": Array [ + 175, + 188, + ], + "type": "String", + "value": "'fake-module'", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 17, + }, + "start": Object { + "column": 20, + "line": 17, + }, + }, + "range": Array [ + 188, + 189, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "nestedArray", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 44, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 17, + 22, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 43, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 23, + 28, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 42, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 29, + 34, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 34, + 42, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "range": Array [ + 28, + 43, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "range": Array [ + 22, + 44, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 15, + ], + "type": "Identifier", + "value": "nestedArray", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 22, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "Identifier", + "value": "Array", + }, + 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": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/never-type-param.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 17, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSNeverKeyword", + }, + ], + "range": Array [ + 10, + 17, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": "Observable", + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "empty", + "range": Array [ + 30, + 35, + ], + "type": "Identifier", + }, + "range": Array [ + 19, + 35, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 19, + 44, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "TSNeverKeyword", + }, + ], + "range": Array [ + 35, + 42, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 19, + 45, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + 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": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + 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": 10, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + "value": "Observable", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "Identifier", + "value": "empty", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "Identifier", + "value": "never", + }, + 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": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "name": "e", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "validateEntity", + "range": Array [ + 41, + 55, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 41, + 58, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 41, + 59, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "s", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + "init": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "e", + "range": Array [ + 72, + 73, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 72, + 74, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 75, + 79, + ], + "type": "Identifier", + }, + "range": Array [ + 72, + 79, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 68, + 79, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 64, + 80, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 82, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processEntity", + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "e", + "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": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "Entity", + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + "value": "processEntity", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "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": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + "value": "Entity", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 41, + 55, + ], + "type": "Identifier", + "value": "validateEntity", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 64, + 67, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "value": "s", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "TSNullKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "y", + "range": Array [ + 17, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 18, + 29, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 29, + ], + "type": "TSUndefinedKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 29, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 30, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "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": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Keyword", + "value": "null", + }, + 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": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 29, + ], + "type": "Identifier", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/nullish-coalescing.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "len", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + }, + "init": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "s", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "operator": "??", + "range": Array [ + 59, + 66, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 64, + 66, + ], + "raw": "''", + "type": "Literal", + "value": "", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 52, + 67, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 48, + 68, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 70, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processNullishCoalesce", + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "name": "s", + "optional": true, + "range": Array [ + 32, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 70, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 71, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + "value": "processNullishCoalesce", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "s", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 48, + 51, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "value": "len", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "value": "s", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "Punctuator", + "value": "??", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 64, + 66, + ], + "type": "String", + "value": "''", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/object-with-escaped-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 13, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, + }, + ], + "range": Array [ + 1, + 15, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 22, + 26, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "method": true, + "range": Array [ + 22, + 31, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 26, + 31, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 20, + 33, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 19, + 35, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 41, + 45, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "method": false, + "range": Array [ + 40, + 52, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 48, + 52, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, + }, + ], + "range": Array [ + 38, + 54, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 37, + 56, + ], + "type": "ExpressionStatement", + }, + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 68, + 72, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 68, + 79, + ], + "static": false, + "type": "ClassProperty", + "value": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 75, + 79, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 66, + 81, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "X", + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 58, + 81, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "type": "String", + "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": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 41, + 45, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 48, + 52, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 58, + 63, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 68, + 72, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 22, + "line": 7, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/object-with-typed-methods.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 16, + 29, + ], + "raw": "\\"constructor\\"", + "type": "Literal", + "value": "constructor", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 16, + 61, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 57, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 43, + 61, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 29, + 61, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 34, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "range": Array [ + 30, + 31, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 29, + 32, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "foo", + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "method": true, + "range": Array [ + 65, + 100, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 95, + 96, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 88, + 96, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 82, + 100, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 68, + 100, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 73, + 81, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 75, + 81, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "T", + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + }, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 68, + 71, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "name": "a", + "range": Array [ + 108, + 109, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "method": false, + "range": Array [ + 104, + 138, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 133, + 134, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 126, + 134, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 120, + 138, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "params": Array [], + "range": Array [ + 109, + 138, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 111, + 119, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 113, + 119, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 6, + "line": 11, + }, + }, + "name": "a", + "range": Array [ + 146, + 147, + ], + "type": "Identifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "method": false, + "range": Array [ + 142, + 172, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 27, + "line": 11, + }, + }, + "range": Array [ + 167, + 172, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 7, + "line": 11, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "name": "x", + "range": Array [ + 148, + 157, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 149, + 157, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 11, + "line": 11, + }, + }, + "range": Array [ + 151, + 157, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 147, + 172, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 11, + }, + "start": Object { + "column": 18, + "line": 11, + }, + }, + "range": Array [ + 158, + 166, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 11, + }, + "start": Object { + "column": 20, + "line": 11, + }, + }, + "range": Array [ + 160, + 166, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 12, + 174, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 174, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 2, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 175, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 176, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 16, + 29, + ], + "type": "String", + "value": "\\"constructor\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 55, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 75, + 81, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 88, + 94, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 113, + 119, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 120, + 121, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 142, + 145, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 6, + "line": 11, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 11, + }, + "start": Object { + "column": 7, + "line": 11, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 148, + 149, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 11, + "line": 11, + }, + }, + "range": Array [ + 151, + 157, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "range": Array [ + 157, + 158, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 11, + }, + "start": Object { + "column": 18, + "line": 11, + }, + }, + "range": Array [ + 158, + 159, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 11, + }, + "start": Object { + "column": 20, + "line": 11, + }, + }, + "range": Array [ + 160, + 166, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 11, + }, + "start": Object { + "column": 27, + "line": 11, + }, + }, + "range": Array [ + 167, + 168, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 171, + 172, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 13, + }, + }, + "range": Array [ + 173, + 174, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 13, + }, + "start": Object { + "column": 1, + "line": 13, + }, + }, + "range": Array [ + 174, + 175, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/optional-chain.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "one", + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "two", + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + }, + "range": Array [ + 40, + 48, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 49, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "one", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "two", + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + }, + "range": Array [ + 52, + 60, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "three", + "range": Array [ + 61, + 66, + ], + "type": "Identifier", + }, + "range": Array [ + 52, + 66, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 52, + 67, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "one", + "range": Array [ + 70, + 73, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "two", + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + }, + "range": Array [ + 70, + 77, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "name": "three", + "range": Array [ + 79, + 84, + ], + "type": "Identifier", + }, + "range": Array [ + 70, + 84, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 70, + 85, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "one", + "range": Array [ + 88, + 91, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "two", + "range": Array [ + 92, + 95, + ], + "type": "Identifier", + }, + "range": Array [ + 88, + 95, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "name": "three", + "range": Array [ + 97, + 102, + ], + "type": "Identifier", + }, + "range": Array [ + 88, + 102, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "name": "four", + "range": Array [ + 103, + 107, + ], + "type": "Identifier", + }, + "range": Array [ + 88, + 107, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 88, + 108, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "one", + "range": Array [ + 111, + 114, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "name": "two", + "range": Array [ + 115, + 118, + ], + "type": "Identifier", + }, + "range": Array [ + 111, + 118, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "name": "three", + "range": Array [ + 120, + 125, + ], + "type": "Identifier", + }, + "range": Array [ + 111, + 125, + ], + "type": "OptionalMemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "name": "four", + "range": Array [ + 127, + 131, + ], + "type": "Identifier", + }, + "range": Array [ + 111, + 131, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 111, + 132, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 134, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptional", + "range": Array [ + 9, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 134, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 135, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 24, + ], + "type": "Identifier", + "value": "processOptional", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "one", + }, + 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": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + 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": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 43, + 45, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 55, + 57, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 61, + 66, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 70, + 73, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 77, + 79, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 79, + 84, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 88, + 91, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 91, + 92, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 92, + 95, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 95, + 97, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 97, + 102, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 103, + 107, + ], + "type": "Identifier", + "value": "four", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 111, + 114, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 115, + 118, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 118, + 120, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 120, + 125, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 125, + 127, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 127, + 131, + ], + "type": "Identifier", + "value": "four", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 22, + "line": 6, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/optional-chain-call.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "one", + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "fn", + "range": Array [ + 49, + 51, + ], + "type": "Identifier", + }, + "range": Array [ + 44, + 51, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 44, + 53, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 44, + 54, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "one", + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "two", + "range": Array [ + 62, + 65, + ], + "type": "Identifier", + }, + "range": Array [ + 57, + 65, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "fn", + "range": Array [ + 66, + 68, + ], + "type": "Identifier", + }, + "range": Array [ + 57, + 68, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 57, + 70, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 57, + 71, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "one", + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "two", + "range": Array [ + 78, + 81, + ], + "type": "Identifier", + }, + "range": Array [ + 74, + 81, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "name": "fn", + "range": Array [ + 83, + 85, + ], + "type": "Identifier", + }, + "range": Array [ + 74, + 85, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 74, + 87, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 88, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "one", + "range": Array [ + 91, + 94, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "two", + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + }, + "range": Array [ + 91, + 98, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "name": "three", + "range": Array [ + 100, + 105, + ], + "type": "Identifier", + }, + "range": Array [ + 91, + 105, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "name": "fn", + "range": Array [ + 106, + 108, + ], + "type": "Identifier", + }, + "range": Array [ + 91, + 108, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 91, + 110, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 91, + 111, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "one", + "range": Array [ + 114, + 117, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "name": "two", + "range": Array [ + 118, + 121, + ], + "type": "Identifier", + }, + "range": Array [ + 114, + 121, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "name": "three", + "range": Array [ + 123, + 128, + ], + "type": "Identifier", + }, + "range": Array [ + 114, + 128, + ], + "type": "OptionalMemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "name": "fn", + "range": Array [ + 130, + 132, + ], + "type": "Identifier", + }, + "range": Array [ + 114, + 132, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 114, + 134, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 114, + 135, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "name": "one", + "range": Array [ + 139, + 142, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "optional": true, + "range": Array [ + 139, + 146, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 139, + 147, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "name": "one", + "range": Array [ + 150, + 153, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": true, + "range": Array [ + 150, + 157, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": false, + "range": Array [ + 150, + 159, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 150, + 160, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "name": "one", + "range": Array [ + 163, + 166, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 163, + 170, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 163, + 174, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 163, + 175, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "object": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "name": "one", + "range": Array [ + 179, + 182, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "optional": true, + "range": Array [ + 179, + 186, + ], + "type": "OptionalCallExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 10, + "line": 12, + }, + }, + "name": "two", + "range": Array [ + 187, + 190, + ], + "type": "Identifier", + }, + "range": Array [ + 179, + 190, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 179, + 191, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 193, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalCall", + "range": Array [ + 9, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 29, + 38, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], "range": Array [ - 147, - 151, + 0, + 193, ], - "type": "Identifier", - "value": "type", + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 194, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, - "line": 14, + "column": 8, + "line": 1, }, "start": Object { - "column": 6, - "line": 14, + "column": 0, + "line": 1, }, }, "range": Array [ - 151, - 152, + 0, + 8, ], - "type": "Punctuator", - "value": ",", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 15, + "column": 28, + "line": 1, }, "start": Object { - "column": 2, - "line": 15, + "column": 9, + "line": 1, }, }, "range": Array [ - 155, - 160, + 9, + 28, ], "type": "Identifier", - "value": "async", + "value": "processOptionalCall", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 15, + "column": 29, + "line": 1, }, "start": Object { - "column": 7, - "line": 15, + "column": 28, + "line": 1, }, }, "range": Array [ - 160, - 161, + 28, + 29, ], "type": "Punctuator", - "value": ",", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 16, + "column": 32, + "line": 1, }, "start": Object { - "column": 2, - "line": 16, + "column": 29, + "line": 1, }, }, "range": Array [ - 164, - 166, + 29, + 32, ], "type": "Identifier", - "value": "is", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 16, + "column": 33, + "line": 1, }, "start": Object { - "column": 4, - "line": 16, + "column": 32, + "line": 1, }, }, "range": Array [ - 166, - 167, + 32, + 33, ], "type": "Punctuator", - "value": ",", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 17, + "column": 34, + "line": 1, }, "start": Object { - "column": 0, - "line": 17, + "column": 33, + "line": 1, }, }, "range": Array [ - 168, - 169, + 33, + 34, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 17, + "column": 38, + "line": 1, }, "start": Object { - "column": 2, - "line": 17, + "column": 35, + "line": 1, }, }, "range": Array [ - 170, - 174, + 35, + 38, ], "type": "Identifier", - "value": "from", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 17, + "column": 39, + "line": 1, }, "start": Object { - "column": 7, - "line": 17, + "column": 38, + "line": 1, }, }, "range": Array [ - 175, - 188, + 38, + 39, ], - "type": "String", - "value": "'fake-module'", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 17, + "column": 41, + "line": 1, }, "start": Object { - "column": 20, - "line": 17, + "column": 40, + "line": 1, }, }, "range": Array [ - 188, - 189, + 40, + 41, ], "type": "Punctuator", - "value": ";", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "nestedArray", - "range": Array [ - 4, - 44, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 44, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 44, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "Array", - "range": Array [ - 17, - 22, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 43, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "Array", - "range": Array [ - 23, - 28, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 42, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "name": "Array", - "range": Array [ - 29, - 34, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 41, - ], - "type": "TSStringKeyword", - }, - ], - "range": Array [ - 34, - 42, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - ], - "range": Array [ - 28, - 43, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - ], - "range": Array [ - 22, - 44, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 44, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 0, 44, + 47, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "one", }, - }, - "range": Array [ - 0, - 44, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 0, - 3, + 47, + 49, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 4, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 4, - 15, + 49, + 51, ], "type": "Identifier", - "value": "nestedArray", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 15, - 16, + 51, + 52, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 17, - 22, + 52, + 53, ], - "type": "Identifier", - "value": "Array", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 22, - 23, + 53, + 54, ], "type": "Punctuator", - "value": "<", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 23, - "line": 1, + "column": 2, + "line": 3, }, }, "range": Array [ - 23, - 28, + 57, + 60, ], "type": "Identifier", - "value": "Array", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 28, - "line": 1, + "column": 5, + "line": 3, }, }, "range": Array [ - 28, - 29, + 60, + 62, ], "type": "Punctuator", - "value": "<", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 10, + "line": 3, }, "start": Object { - "column": 29, - "line": 1, + "column": 7, + "line": 3, }, }, "range": Array [ - 29, - 34, + 62, + 65, ], "type": "Identifier", - "value": "Array", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 34, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 34, - 35, + 65, + 66, ], "type": "Punctuator", - "value": "<", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 13, + "line": 3, }, "start": Object { - "column": 35, - "line": 1, + "column": 11, + "line": 3, }, }, "range": Array [ - 35, - 41, + 66, + 68, ], "type": "Identifier", - "value": "string", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 14, + "line": 3, }, "start": Object { - "column": 41, - "line": 1, + "column": 13, + "line": 3, }, }, "range": Array [ - 41, - 42, + 68, + 69, ], "type": "Punctuator", - "value": ">", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 15, + "line": 3, }, "start": Object { - "column": 42, - "line": 1, + "column": 14, + "line": 3, }, }, "range": Array [ - 42, - 43, + 69, + 70, ], "type": "Punctuator", - "value": ">", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 16, + "line": 3, }, "start": Object { - "column": 43, - "line": 1, + "column": 15, + "line": 3, }, }, "range": Array [ - 43, - 44, + 70, + 71, ], "type": "Punctuator", - "value": ">", + "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/never-type-param.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 6, - 17, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 17, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 17, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "X", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 16, - ], - "type": "TSNeverKeyword", - }, - ], - "range": Array [ - 10, - 17, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 17, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 0, - 18, + 74, + 77, ], - "type": "VariableDeclaration", + "type": "Identifier", + "value": "one", }, Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "name": "Observable", - "range": Array [ - 19, - 29, - ], - "type": "Identifier", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "empty", - "range": Array [ - 30, - 35, - ], - "type": "Identifier", - }, - "range": Array [ - 19, - 35, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "optional": false, - "range": Array [ - 19, - 44, - ], - "type": "CallExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 36, - 41, - ], - "type": "TSNeverKeyword", - }, - ], - "range": Array [ - 35, - 42, - ], - "type": "TSTypeParameterInstantiation", - }, - }, "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 6, + "line": 4, }, "start": Object { - "column": 0, - "line": 2, + "column": 5, + "line": 4, }, }, "range": Array [ - 19, - 45, + 77, + 78, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ".", }, - }, - "range": Array [ - 0, - 46, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 9, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 6, + "line": 4, }, }, "range": Array [ - 0, - 5, + 78, + 81, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 11, + "line": 4, }, "start": Object { - "column": 6, - "line": 1, + "column": 9, + "line": 4, }, }, "range": Array [ - 6, - 7, + 81, + 83, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 13, + "line": 4, }, "start": Object { - "column": 7, - "line": 1, + "column": 11, + "line": 4, }, }, "range": Array [ - 7, - 8, + 83, + 85, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 14, + "line": 4, }, "start": Object { - "column": 9, - "line": 1, + "column": 13, + "line": 4, }, }, "range": Array [ - 9, - 10, + 85, + 86, ], - "type": "Identifier", - "value": "X", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 15, + "line": 4, }, "start": Object { - "column": 10, - "line": 1, + "column": 14, + "line": 4, }, }, "range": Array [ - 10, - 11, + 86, + 87, ], "type": "Punctuator", - "value": "<", + "value": ")", }, Object { "loc": Object { "end": Object { "column": 16, - "line": 1, + "line": 4, }, "start": Object { - "column": 11, - "line": 1, + "column": 15, + "line": 4, }, }, "range": Array [ - 11, - 16, + 87, + 88, ], - "type": "Identifier", - "value": "never", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 5, + "line": 5, }, "start": Object { - "column": 16, - "line": 1, + "column": 2, + "line": 5, }, }, "range": Array [ - 16, - 17, + 91, + 94, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 6, + "line": 5, }, "start": Object { - "column": 17, - "line": 1, + "column": 5, + "line": 5, }, }, "range": Array [ - 17, - 18, + 94, + 95, ], "type": "Punctuator", - "value": ";", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 9, + "line": 5, }, "start": Object { - "column": 0, - "line": 2, + "column": 6, + "line": 5, }, }, "range": Array [ - 19, - 29, + 95, + 98, ], "type": "Identifier", - "value": "Observable", + "value": "two", }, Object { "loc": Object { "end": Object { "column": 11, - "line": 2, + "line": 5, }, "start": Object { - "column": 10, - "line": 2, + "column": 9, + "line": 5, }, }, "range": Array [ - 29, - 30, + 98, + 100, ], "type": "Punctuator", - "value": ".", + "value": "?.", }, Object { "loc": Object { "end": Object { "column": 16, - "line": 2, + "line": 5, }, "start": Object { "column": 11, - "line": 2, + "line": 5, }, }, "range": Array [ - 30, - 35, + 100, + 105, ], "type": "Identifier", - "value": "empty", + "value": "three", }, Object { "loc": Object { "end": Object { "column": 17, - "line": 2, + "line": 5, }, "start": Object { "column": 16, - "line": 2, + "line": 5, }, }, "range": Array [ - 35, - 36, + 105, + 106, ], "type": "Punctuator", - "value": "<", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 19, + "line": 5, }, "start": Object { "column": 17, - "line": 2, + "line": 5, }, }, "range": Array [ - 36, - 41, + 106, + 108, ], "type": "Identifier", - "value": "never", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 41, - 42, - ], - "type": "Punctuator", - "value": ">", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 20, + "line": 5, }, "start": Object { - "column": 23, - "line": 2, + "column": 19, + "line": 5, }, }, "range": Array [ - 42, - 43, + 108, + 109, ], "type": "Punctuator", "value": "(", @@ -64167,17 +74737,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 21, + "line": 5, }, "start": Object { - "column": 24, - "line": 2, + "column": 20, + "line": 5, }, }, "range": Array [ - 43, - 44, + 109, + 110, ], "type": "Punctuator", "value": ")", @@ -64185,516 +74755,179 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 22, + "line": 5, }, "start": Object { - "column": 25, - "line": 2, + "column": 21, + "line": 5, }, }, "range": Array [ - 44, - 45, + 110, + 111, ], "type": "Punctuator", "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": "e", - "range": Array [ - 56, - 57, - ], - "type": "Identifier", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "validateEntity", - "range": Array [ - 41, - 55, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "optional": false, - "range": Array [ - 41, - 58, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 41, - 59, - ], - "type": "ExpressionStatement", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "name": "s", - "range": Array [ - 68, - 69, - ], - "type": "Identifier", - }, - "init": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "object": Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "name": "e", - "range": Array [ - 72, - 73, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "range": Array [ - 72, - 74, - ], - "type": "TSNonNullExpression", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 75, - 79, - ], - "type": "Identifier", - }, - "range": Array [ - 72, - 79, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 68, - 79, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 20, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 64, - 80, - ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 82, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "processEntity", - "range": Array [ - 9, - 22, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 5, + "line": 6, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 6, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "e", - "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": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "name": "Entity", - "range": Array [ - 27, - 33, - ], - "type": "Identifier", - }, - }, - }, - }, - ], "range": Array [ - 0, - 82, + 114, + 117, ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "one", }, - }, - "range": Array [ - 0, - 82, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 6, + "line": 6, }, "start": Object { - "column": 0, - "line": 1, + "column": 5, + "line": 6, }, }, "range": Array [ - 0, - 8, + 117, + 118, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 9, + "line": 6, }, "start": Object { - "column": 9, - "line": 1, + "column": 6, + "line": 6, }, }, "range": Array [ - 9, - 22, + 118, + 121, ], "type": "Identifier", - "value": "processEntity", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 11, + "line": 6, }, "start": Object { - "column": 22, - "line": 1, + "column": 9, + "line": 6, }, }, "range": Array [ - 22, - 23, + 121, + 123, ], "type": "Punctuator", - "value": "(", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 16, + "line": 6, }, "start": Object { - "column": 23, - "line": 1, + "column": 11, + "line": 6, }, }, "range": Array [ - 23, - 24, + 123, + 128, ], "type": "Identifier", - "value": "e", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 18, + "line": 6, }, "start": Object { - "column": 24, - "line": 1, + "column": 16, + "line": 6, }, }, "range": Array [ - 24, - 25, + 128, + 130, ], "type": "Punctuator", - "value": "?", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 20, + "line": 6, }, "start": Object { - "column": 25, - "line": 1, + "column": 18, + "line": 6, }, }, "range": Array [ - 25, - 26, + 130, + 132, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 21, + "line": 6, }, "start": Object { - "column": 27, - "line": 1, + "column": 20, + "line": 6, }, }, "range": Array [ - 27, - 33, + 132, + 133, ], - "type": "Identifier", - "value": "Entity", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 22, + "line": 6, }, "start": Object { - "column": 33, - "line": 1, + "column": 21, + "line": 6, }, }, "range": Array [ - 33, - 34, + 133, + 134, ], "type": "Punctuator", "value": ")", @@ -64702,89 +74935,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 23, + "line": 6, }, "start": Object { - "column": 35, - "line": 1, + "column": 22, + "line": 6, }, }, "range": Array [ - 35, - 36, + 134, + 135, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 5, + "line": 8, }, "start": Object { - "column": 4, - "line": 2, + "column": 2, + "line": 8, }, }, "range": Array [ - 41, - 55, + 139, + 142, ], "type": "Identifier", - "value": "validateEntity", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 7, + "line": 8, }, "start": Object { - "column": 18, - "line": 2, + "column": 5, + "line": 8, }, }, "range": Array [ - 55, - 56, + 142, + 144, ], "type": "Punctuator", - "value": "(", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 8, + "line": 8, }, "start": Object { - "column": 19, - "line": 2, + "column": 7, + "line": 8, }, }, "range": Array [ - 56, - 57, + 144, + 145, ], - "type": "Identifier", - "value": "e", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 9, + "line": 8, }, "start": Object { - "column": 20, - "line": 2, + "column": 8, + "line": 8, }, }, "range": Array [ - 57, - 58, + 145, + 146, ], "type": "Punctuator", "value": ")", @@ -64792,17 +75025,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 10, + "line": 8, }, "start": Object { - "column": 21, - "line": 2, + "column": 9, + "line": 8, }, }, "range": Array [ - 58, - 59, + 146, + 147, ], "type": "Punctuator", "value": ";", @@ -64810,556 +75043,423 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 5, + "line": 9, }, "start": Object { - "column": 4, - "line": 3, + "column": 2, + "line": 9, }, }, "range": Array [ - 64, - 67, + 150, + 153, ], - "type": "Keyword", - "value": "let", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 7, + "line": 9, }, "start": Object { + "column": 5, + "line": 9, + }, + }, + "range": Array [ + 153, + 155, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { "column": 8, - "line": 3, + "line": 9, + }, + "start": Object { + "column": 7, + "line": 9, }, }, "range": Array [ - 68, - 69, + 155, + 156, ], - "type": "Identifier", - "value": "s", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, + "column": 9, + "line": 9, }, "start": Object { - "column": 10, - "line": 3, + "column": 8, + "line": 9, }, }, "range": Array [ - 70, - 71, + 156, + 157, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 10, + "line": 9, }, "start": Object { - "column": 12, - "line": 3, + "column": 9, + "line": 9, }, }, "range": Array [ - 72, - 73, + 157, + 158, ], - "type": "Identifier", - "value": "e", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 11, + "line": 9, }, "start": Object { - "column": 13, - "line": 3, + "column": 10, + "line": 9, }, }, "range": Array [ - 73, - 74, + 158, + 159, ], "type": "Punctuator", - "value": "!", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 12, + "line": 9, }, "start": Object { - "column": 14, - "line": 3, + "column": 11, + "line": 9, }, }, "range": Array [ - 74, - 75, + 159, + 160, ], "type": "Punctuator", - "value": ".", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 5, + "line": 10, }, "start": Object { - "column": 15, - "line": 3, + "column": 2, + "line": 10, }, }, "range": Array [ - 75, - 79, + 163, + 166, ], "type": "Identifier", - "value": "name", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 3, + "column": 7, + "line": 10, }, "start": Object { - "column": 19, - "line": 3, + "column": 5, + "line": 10, }, }, "range": Array [ - 79, - 80, + 166, + 168, ], "type": "Punctuator", - "value": ";", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 8, + "line": 10, }, "start": Object { - "column": 0, - "line": 4, + "column": 7, + "line": 10, }, }, "range": Array [ - 81, - 82, + 168, + 169, ], "type": "Punctuator", - "value": "}", + "value": "(", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 11, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 11, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 11, - ], - "type": "TSNullKeyword", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 11, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 9, + "line": 10, }, "start": Object { - "column": 0, - "line": 1, + "column": 8, + "line": 10, }, }, "range": Array [ - 0, - 12, + 169, + 170, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": ")", }, Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "y", - "range": Array [ - 17, - 29, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 18, - 29, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 20, - 29, - ], - "type": "TSUndefinedKeyword", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 17, - 29, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 11, + "line": 10, }, "start": Object { - "column": 0, - "line": 2, + "column": 9, + "line": 10, }, }, "range": Array [ - 13, - 30, + 170, + 172, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 30, - ], - "sourceType": "script", - "tokens": Array [ + "type": "Punctuator", + "value": "?.", + }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 12, + "line": 10, }, "start": Object { - "column": 0, - "line": 1, + "column": 11, + "line": 10, }, }, "range": Array [ - 0, - 3, + 172, + 173, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 13, + "line": 10, }, "start": Object { - "column": 4, - "line": 1, + "column": 12, + "line": 10, }, }, "range": Array [ - 4, - 5, + 173, + 174, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 14, + "line": 10, }, "start": Object { - "column": 5, - "line": 1, + "column": 13, + "line": 10, }, }, "range": Array [ - 5, - 6, + 174, + 175, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 5, + "line": 12, }, "start": Object { - "column": 7, - "line": 1, + "column": 2, + "line": 12, }, }, "range": Array [ - 7, - 11, + 179, + 182, ], - "type": "Keyword", - "value": "null", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 7, + "line": 12, }, "start": Object { - "column": 11, - "line": 1, + "column": 5, + "line": 12, }, }, "range": Array [ - 11, - 12, + 182, + 184, ], "type": "Punctuator", - "value": ";", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 8, + "line": 12, }, "start": Object { - "column": 0, - "line": 2, + "column": 7, + "line": 12, }, }, "range": Array [ - 13, - 16, + 184, + 185, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 9, + "line": 12, }, "start": Object { - "column": 4, - "line": 2, + "column": 8, + "line": 12, }, }, "range": Array [ - 17, - 18, + 185, + 186, ], - "type": "Identifier", - "value": "y", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 10, + "line": 12, }, "start": Object { - "column": 5, - "line": 2, + "column": 9, + "line": 12, }, }, "range": Array [ - 18, - 19, + 186, + 187, ], "type": "Punctuator", - "value": ":", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 13, + "line": 12, }, "start": Object { - "column": 7, - "line": 2, + "column": 10, + "line": 12, }, }, "range": Array [ - 20, - 29, + 187, + 190, ], "type": "Identifier", - "value": "undefined", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 14, + "line": 12, }, "start": Object { - "column": 16, - "line": 2, + "column": 13, + "line": 12, }, }, "range": Array [ - 29, - 30, + 190, + 191, ], "type": "Punctuator", "value": ";", }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 13, + }, + }, + "range": Array [ + 192, + 193, + ], + "type": "Punctuator", + "value": "}", + }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/nullish-coalescing.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-call-with-parens.src 1`] = ` Object { "body": Array [ Object { @@ -65367,129 +75467,987 @@ Object { "body": Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "object": Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 2, }, "start": Object { - "column": 6, + "column": 3, "line": 2, }, }, - "name": "len", + "name": "one", "range": Array [ - 52, - 55, + 51, + 54, ], "type": "Identifier", }, - "init": Object { - "left": Object { + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "fn", + "range": Array [ + 56, + 58, + ], + "type": "Identifier", + }, + "range": Array [ + 51, + 58, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 51, + 60, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 50, + 62, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "object": Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 6, + "line": 3, }, "start": Object { - "column": 13, - "line": 2, + "column": 3, + "line": 3, }, }, - "name": "s", + "name": "one", "range": Array [ - 59, - 60, + 66, + 69, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "two", + "range": Array [ + 71, + 74, + ], + "type": "Identifier", + }, + "range": Array [ + 66, + 74, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "fn", + "range": Array [ + 76, + 78, + ], + "type": "Identifier", + }, + "range": Array [ + 65, + 78, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 65, + 80, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 65, + 81, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "name": "one", + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "name": "two", + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + }, + "range": Array [ + 85, + 92, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "name": "fn", + "range": Array [ + 94, + 96, + ], + "type": "Identifier", + }, + "range": Array [ + 85, + 96, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 85, + 98, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 84, + 100, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "one", + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "name": "two", + "range": Array [ + 108, + 111, + ], + "type": "Identifier", + }, + "range": Array [ + 104, + 111, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "name": "three", + "range": Array [ + 113, + 118, + ], + "type": "Identifier", + }, + "range": Array [ + 104, + 118, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "name": "fn", + "range": Array [ + 120, + 122, + ], + "type": "Identifier", + }, + "range": Array [ + 103, + 122, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 103, + 124, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 103, + 125, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "name": "one", + "range": Array [ + 129, + 132, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "name": "two", + "range": Array [ + 133, + 136, + ], + "type": "Identifier", + }, + "range": Array [ + 129, + 136, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "name": "three", + "range": Array [ + 138, + 143, ], "type": "Identifier", }, + "range": Array [ + 129, + 143, + ], + "type": "OptionalMemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "name": "fn", + "range": Array [ + 145, + 147, + ], + "type": "Identifier", + }, + "range": Array [ + 129, + 147, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 129, + 149, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 128, + 151, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "name": "one", + "range": Array [ + 156, + 159, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "optional": true, + "range": Array [ + 156, + 163, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 155, + 165, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "name": "one", + "range": Array [ + 169, + 172, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "optional": true, + "range": Array [ + 169, + 176, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": false, + "range": Array [ + 168, + 179, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 168, + 180, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "name": "one", + "range": Array [ + 184, + 187, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 184, + 191, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 183, + 196, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 183, + 197, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "object": Object { + "arguments": Array [], + "callee": Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 6, + "line": 12, }, "start": Object { - "column": 13, - "line": 2, + "column": 3, + "line": 12, }, }, - "operator": "??", + "name": "one", "range": Array [ - 59, - 66, + 202, + 205, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 64, - 66, - ], - "raw": "''", - "type": "Literal", - "value": "", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, }, - "type": "LogicalExpression", }, + "optional": true, + "range": Array [ + 202, + 209, + ], + "type": "OptionalCallExpression", + }, + "optional": false, + "property": Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 15, + "line": 12, }, "start": Object { - "column": 6, - "line": 2, + "column": 12, + "line": 12, }, }, + "name": "two", "range": Array [ - 52, - 67, + 211, + 214, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - ], - "kind": "let", + "range": Array [ + 201, + 214, + ], + "type": "MemberExpression", + }, "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 16, + "line": 12, }, "start": Object { "column": 2, - "line": 2, + "line": 12, }, }, "range": Array [ - 48, - 68, + 201, + 215, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 13, }, "start": Object { - "column": 44, + "column": 46, "line": 1, }, }, "range": Array [ - 44, - 70, + 46, + 217, ], "type": "BlockStatement", }, @@ -65498,7 +76456,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 31, + "column": 34, "line": 1, }, "start": Object { @@ -65506,17 +76464,17 @@ Object { "line": 1, }, }, - "name": "processNullishCoalesce", + "name": "processOptionalCallParens", "range": Array [ 9, - 31, + 34, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 13, }, "start": Object { "column": 0, @@ -65527,60 +76485,60 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 44, "line": 1, }, "start": Object { - "column": 32, + "column": 35, "line": 1, }, }, - "name": "s", + "name": "one", "optional": true, "range": Array [ - 32, - 42, + 35, + 44, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 44, "line": 1, }, "start": Object { - "column": 34, + "column": 39, "line": 1, }, }, "range": Array [ - 34, - 42, + 39, + 44, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 42, + "column": 44, "line": 1, }, "start": Object { - "column": 36, + "column": 41, "line": 1, }, }, "range": Array [ - 36, - 42, + 41, + 44, ], - "type": "TSStringKeyword", + "type": "TSAnyKeyword", }, }, }, ], "range": Array [ 0, - 70, + 217, ], "type": "FunctionDeclaration", }, @@ -65588,7 +76546,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 14, }, "start": Object { "column": 0, @@ -65597,7 +76555,7 @@ Object { }, "range": Array [ 0, - 71, + 218, ], "sourceType": "script", "tokens": Array [ @@ -65622,7 +76580,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 34, "line": 1, }, "start": Object { @@ -65632,25 +76590,25 @@ Object { }, "range": Array [ 9, - 31, + 34, ], "type": "Identifier", - "value": "processNullishCoalesce", + "value": "processOptionalCallParens", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 35, "line": 1, }, "start": Object { - "column": 31, + "column": 34, "line": 1, }, }, "range": Array [ - 31, - 32, + 34, + 35, ], "type": "Punctuator", "value": "(", @@ -65658,35 +76616,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 38, "line": 1, }, "start": Object { - "column": 32, + "column": 35, "line": 1, }, }, "range": Array [ - 32, - 33, + 35, + 38, ], "type": "Identifier", - "value": "s", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 39, "line": 1, }, "start": Object { - "column": 33, + "column": 38, "line": 1, }, }, "range": Array [ - 33, - 34, + 38, + 39, ], "type": "Punctuator", "value": "?", @@ -65694,17 +76652,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 40, "line": 1, }, "start": Object { - "column": 34, + "column": 39, "line": 1, }, }, "range": Array [ - 34, - 35, + 39, + 40, ], "type": "Punctuator", "value": ":", @@ -65712,35 +76670,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 44, "line": 1, }, "start": Object { - "column": 36, + "column": 41, "line": 1, }, }, "range": Array [ - 36, - 42, + 41, + 44, ], "type": "Identifier", - "value": "string", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 45, "line": 1, }, "start": Object { - "column": 42, + "column": 44, "line": 1, }, }, "range": Array [ - 42, - 43, + 44, + 45, ], "type": "Punctuator", "value": ")", @@ -65748,17 +76706,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, + "column": 47, "line": 1, }, "start": Object { - "column": 44, + "column": 46, "line": 1, }, }, "range": Array [ - 44, - 45, + 46, + 47, ], "type": "Punctuator", "value": "{", @@ -65766,7 +76724,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 2, }, "start": Object { @@ -65775,134 +76733,116 @@ Object { }, }, "range": Array [ - 48, + 50, 51, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 2, }, "start": Object { - "column": 6, + "column": 3, "line": 2, }, }, "range": Array [ - 52, - 55, + 51, + 54, ], "type": "Identifier", - "value": "len", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 8, "line": 2, }, "start": Object { - "column": 10, + "column": 6, "line": 2, }, }, "range": Array [ + 54, 56, - 57, ], "type": "Punctuator", - "value": "=", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 2, }, "start": Object { - "column": 12, + "column": 8, "line": 2, }, }, "range": Array [ + 56, 58, - 59, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 59, - 60, ], "type": "Identifier", - "value": "s", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 2, }, "start": Object { - "column": 15, + "column": 10, "line": 2, }, }, "range": Array [ - 61, - 63, + 58, + 59, ], "type": "Punctuator", - "value": "??", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 12, "line": 2, }, "start": Object { - "column": 18, + "column": 11, "line": 2, }, }, "range": Array [ - 64, - 66, + 59, + 60, ], - "type": "String", - "value": "''", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 13, "line": 2, }, "start": Object { - "column": 20, + "column": 12, "line": 2, }, }, "range": Array [ - 66, - 67, + 60, + 61, ], "type": "Punctuator", "value": ")", @@ -65910,17 +76850,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 14, "line": 2, }, "start": Object { - "column": 21, + "column": 13, "line": 2, }, }, "range": Array [ - 67, - 68, + 61, + 62, ], "type": "Punctuator", "value": ";", @@ -65928,648 +76868,25 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 69, - 70, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/object-with-escaped-properties.src 1`] = ` -Object { - "body": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "range": Array [ - 3, - 7, - ], - "raw": "'__'", - "type": "Literal", - "value": "__", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 3, - 13, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 13, - ], - "raw": "null", - "type": "Literal", - "value": null, - }, - }, - ], - "range": Array [ - 1, - 15, - ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 17, - ], - "type": "ExpressionStatement", - }, - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 1, - "line": 3, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 3, - "line": 3, - }, - }, - "range": Array [ - 22, - 26, - ], - "raw": "'__'", - "type": "Literal", - "value": "__", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 3, - "line": 3, - }, - }, - "method": true, - "range": Array [ - 22, - 31, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 29, - 31, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 26, - 31, - ], - "type": "FunctionExpression", - }, - }, - ], - "range": Array [ - 20, - 33, - ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 19, - 35, - ], - "type": "ExpressionStatement", - }, - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 1, - "line": 5, - }, - }, - "properties": Array [ - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "range": Array [ - 41, - 45, - ], - "raw": "'__'", - "type": "Literal", - "value": "__", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 15, - "line": 5, - }, - "start": Object { - "column": 3, - "line": 5, - }, - }, - "method": false, - "range": Array [ - 40, - 52, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 5, - }, - "start": Object { - "column": 11, - "line": 5, - }, - }, - "range": Array [ - 48, - 52, - ], - "raw": "null", - "type": "Literal", - "value": null, - }, - }, - ], - "range": Array [ - 38, - 54, - ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, - }, - }, - "range": Array [ - 37, - 56, - ], - "type": "ExpressionStatement", - }, - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 7, - }, - "start": Object { - "column": 10, - "line": 7, - }, - }, - "range": Array [ - 68, - 72, - ], - "raw": "'__'", - "type": "Literal", - "value": "__", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 7, - }, - "start": Object { - "column": 10, - "line": 7, - }, - }, - "range": Array [ - 68, - 79, - ], - "static": false, - "type": "ClassProperty", - "value": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 7, - }, - "start": Object { - "column": 17, - "line": 7, - }, - }, - "range": Array [ - 75, - 79, - ], - "raw": "null", - "type": "Literal", - "value": null, - }, - }, - ], - "loc": Object { - "end": Object { - "column": 23, - "line": 7, - }, - "start": Object { - "column": 8, - "line": 7, - }, - }, - "range": Array [ - 66, - 81, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 7, - }, - "start": Object { - "column": 6, - "line": 7, - }, - }, - "name": "X", - "range": Array [ - 64, - 65, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 7, - }, - "start": Object { - "column": 0, - "line": 7, - }, - }, - "range": Array [ - 58, - 81, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 8, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 82, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 2, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { "column": 3, - "line": 1, - }, - }, - "range": Array [ - 3, - 7, - ], - "type": "String", - "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": 13, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 13, - ], - "type": "Keyword", - "value": "null", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, "line": 3, }, "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { "column": 2, "line": 3, }, - "start": Object { - "column": 1, - "line": 3, - }, }, "range": Array [ - 20, - 21, + 65, + 66, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 6, "line": 3, }, "start": Object { @@ -66578,11 +76895,11 @@ Object { }, }, "range": Array [ - 22, - 26, + 66, + 69, ], - "type": "String", - "value": "'__'", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { @@ -66591,34 +76908,16 @@ Object { "line": 3, }, "start": Object { - "column": 7, - "line": 3, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 8, + "column": 6, "line": 3, }, }, "range": Array [ - 27, - 28, + 69, + 71, ], "type": "Punctuator", - "value": ")", + "value": "?.", }, Object { "loc": Object { @@ -66627,16 +76926,16 @@ Object { "line": 3, }, "start": Object { - "column": 10, + "column": 8, "line": 3, }, }, "range": Array [ - 29, - 30, + 71, + 74, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { @@ -66650,29 +76949,29 @@ Object { }, }, "range": Array [ - 30, - 31, + 74, + 75, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 3, }, "start": Object { - "column": 13, + "column": 12, "line": 3, }, }, "range": Array [ - 32, - 33, + 75, + 76, ], "type": "Punctuator", - "value": "}", + "value": ".", }, Object { "loc": Object { @@ -66681,16 +76980,16 @@ Object { "line": 3, }, "start": Object { - "column": 14, + "column": 13, "line": 3, }, }, "range": Array [ - 33, - 34, + 76, + 78, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { @@ -66704,1300 +77003,458 @@ Object { }, }, "range": Array [ - 34, - 35, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, - }, - }, - "range": Array [ - 37, - 38, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 5, - }, - "start": Object { - "column": 1, - "line": 5, - }, - }, - "range": Array [ - 38, - 39, + 78, + 79, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 5, + "column": 17, + "line": 3, }, "start": Object { - "column": 3, - "line": 5, + "column": 16, + "line": 3, }, }, "range": Array [ - 40, - 41, + 79, + 80, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 5, + "column": 18, + "line": 3, }, "start": Object { - "column": 4, - "line": 5, + "column": 17, + "line": 3, }, }, "range": Array [ - 41, - 45, + 80, + 81, ], - "type": "String", - "value": "'__'", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 3, + "line": 4, }, "start": Object { - "column": 8, - "line": 5, + "column": 2, + "line": 4, }, }, "range": Array [ - 45, - 46, + 84, + 85, ], "type": "Punctuator", - "value": "]", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 6, + "line": 4, }, "start": Object { - "column": 9, - "line": 5, + "column": 3, + "line": 4, }, }, "range": Array [ - 46, - 47, + 85, + 88, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 5, + "column": 7, + "line": 4, }, "start": Object { - "column": 11, - "line": 5, + "column": 6, + "line": 4, }, }, "range": Array [ - 48, - 52, + 88, + 89, ], - "type": "Keyword", - "value": "null", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 5, + "column": 10, + "line": 4, }, "start": Object { - "column": 16, - "line": 5, + "column": 7, + "line": 4, }, }, "range": Array [ - 53, - 54, + 89, + 92, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 5, + "column": 12, + "line": 4, }, "start": Object { - "column": 17, - "line": 5, + "column": 10, + "line": 4, }, }, "range": Array [ - 54, - 55, + 92, + 94, ], "type": "Punctuator", - "value": ")", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 5, + "column": 14, + "line": 4, }, "start": Object { - "column": 18, - "line": 5, + "column": 12, + "line": 4, }, }, "range": Array [ - 55, - 56, + 94, + 96, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 7, + "column": 15, + "line": 4, }, "start": Object { - "column": 0, - "line": 7, + "column": 14, + "line": 4, }, }, "range": Array [ - 58, - 63, + 96, + 97, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 7, + "column": 16, + "line": 4, }, "start": Object { - "column": 6, - "line": 7, + "column": 15, + "line": 4, }, }, "range": Array [ - 64, - 65, + 97, + 98, ], - "type": "Identifier", - "value": "X", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 7, + "column": 17, + "line": 4, }, "start": Object { - "column": 8, - "line": 7, + "column": 16, + "line": 4, }, }, "range": Array [ - 66, - 67, + 98, + 99, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 7, + "column": 18, + "line": 4, }, "start": Object { - "column": 10, - "line": 7, + "column": 17, + "line": 4, }, }, "range": Array [ - 68, - 72, + 99, + 100, ], - "type": "String", - "value": "'__'", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 7, + "column": 3, + "line": 5, }, "start": Object { - "column": 15, - "line": 7, + "column": 2, + "line": 5, }, }, "range": Array [ - 73, - 74, + 103, + 104, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 7, + "column": 6, + "line": 5, }, "start": Object { - "column": 17, - "line": 7, + "column": 3, + "line": 5, }, }, "range": Array [ - 75, - 79, + 104, + 107, ], - "type": "Keyword", - "value": "null", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 7, + "column": 7, + "line": 5, }, "start": Object { - "column": 22, - "line": 7, + "column": 6, + "line": 5, }, }, "range": Array [ - 80, - 81, + 107, + 108, ], "type": "Punctuator", - "value": "}", + "value": ".", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/object-with-typed-methods.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 13, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 16, - 29, - ], - "raw": "\\"constructor\\"", - "type": "Literal", - "value": "constructor", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 3, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "method": true, - "range": Array [ - 16, - 61, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 56, - 57, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 49, - 57, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 4, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "range": Array [ - 43, - 61, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 3, - "line": 4, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 29, - 61, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 34, - 42, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 36, - 42, - ], - "type": "TSNumberKeyword", - }, - }, - "type": "FunctionExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "T", - "range": Array [ - 30, - 31, - ], - "type": "Identifier", - }, - "range": Array [ - 30, - 31, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 29, - 32, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "name": "foo", - "range": Array [ - 65, - 68, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 3, - "line": 7, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "method": true, - "range": Array [ - 65, - 100, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 11, - "line": 6, - }, - }, - "range": Array [ - 95, - 96, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "range": Array [ - 88, - 96, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 7, - }, - "start": Object { - "column": 19, - "line": 5, - }, - }, - "range": Array [ - 82, - 100, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 3, - "line": 7, - }, - "start": Object { - "column": 5, - "line": 5, - }, - }, - "params": Array [], - "range": Array [ - 68, - 100, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 5, - }, - "start": Object { - "column": 10, - "line": 5, - }, - }, - "range": Array [ - 73, - 81, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 5, - }, - "start": Object { - "column": 12, - "line": 5, - }, - }, - "range": Array [ - 75, - 81, - ], - "type": "TSNumberKeyword", - }, - }, - "type": "FunctionExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 5, - "line": 5, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "name": "T", - "range": Array [ - 69, - 70, - ], - "type": "Identifier", - }, - "range": Array [ - 69, - 70, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 68, - 71, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 8, - }, - "start": Object { - "column": 6, - "line": 8, - }, - }, - "name": "a", - "range": Array [ - 108, - 109, - ], - "type": "Identifier", - }, - "kind": "get", - "loc": Object { - "end": Object { - "column": 3, - "line": 10, - }, - "start": Object { - "column": 2, - "line": 8, - }, - }, - "method": false, - "range": Array [ - 104, - 138, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 9, - }, - "start": Object { - "column": 11, - "line": 9, - }, - }, - "range": Array [ - 133, - 134, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 9, - }, - "start": Object { - "column": 4, - "line": 9, - }, - }, - "range": Array [ - 126, - 134, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 10, - }, - "start": Object { - "column": 18, - "line": 8, - }, - }, - "range": Array [ - 120, - 138, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 3, - "line": 10, - }, - "start": Object { - "column": 7, - "line": 8, - }, - }, - "params": Array [], - "range": Array [ - 109, - 138, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 8, - }, - "start": Object { - "column": 9, - "line": 8, - }, - }, - "range": Array [ - 111, - 119, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 8, - }, - "start": Object { - "column": 11, - "line": 8, - }, - }, - "range": Array [ - 113, - 119, - ], - "type": "TSNumberKeyword", - }, - }, - "type": "FunctionExpression", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 11, - }, - "start": Object { - "column": 6, - "line": 11, - }, - }, - "name": "a", - "range": Array [ - 146, - 147, - ], - "type": "Identifier", - }, - "kind": "set", - "loc": Object { - "end": Object { - "column": 3, - "line": 12, - }, - "start": Object { - "column": 2, - "line": 11, - }, - }, - "method": false, - "range": Array [ - 142, - 172, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 3, - "line": 12, - }, - "start": Object { - "column": 27, - "line": 11, - }, - }, - "range": Array [ - 167, - 172, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 3, - "line": 12, - }, - "start": Object { - "column": 7, - "line": 11, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 11, - }, - "start": Object { - "column": 8, - "line": 11, - }, - }, - "name": "x", - "range": Array [ - 148, - 157, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 11, - }, - "start": Object { - "column": 9, - "line": 11, - }, - }, - "range": Array [ - 149, - 157, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 11, - }, - "start": Object { - "column": 11, - "line": 11, - }, - }, - "range": Array [ - 151, - 157, - ], - "type": "TSNumberKeyword", - }, - }, - }, - ], - "range": Array [ - 147, - 172, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 11, - }, - "start": Object { - "column": 18, - "line": 11, - }, - }, - "range": Array [ - 158, - 166, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 11, - }, - "start": Object { - "column": 20, - "line": 11, - }, - }, - "range": Array [ - 160, - 166, - ], - "type": "TSNumberKeyword", - }, - }, - "type": "FunctionExpression", - }, - }, - ], - "range": Array [ - 12, - 174, - ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 13, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 174, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", "loc": Object { "end": Object { - "column": 2, - "line": 13, + "column": 10, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 7, + "line": 5, }, }, "range": Array [ - 0, - 175, + 108, + 111, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 14, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "two", }, - }, - "range": Array [ - 0, - 176, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 12, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 10, + "line": 5, }, }, "range": Array [ - 0, - 5, + 111, + 113, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 17, + "line": 5, }, "start": Object { - "column": 6, - "line": 1, + "column": 12, + "line": 5, }, }, "range": Array [ - 6, - 9, + 113, + 118, ], "type": "Identifier", - "value": "foo", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 18, + "line": 5, }, "start": Object { - "column": 10, - "line": 1, + "column": 17, + "line": 5, }, }, "range": Array [ - 10, - 11, + 118, + 119, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 19, + "line": 5, }, "start": Object { - "column": 12, - "line": 1, + "column": 18, + "line": 5, }, }, "range": Array [ - 12, - 13, + 119, + 120, ], "type": "Punctuator", - "value": "{", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 21, + "line": 5, }, "start": Object { - "column": 2, - "line": 2, + "column": 19, + "line": 5, }, }, "range": Array [ - 16, - 29, + 120, + 122, ], - "type": "String", - "value": "\\"constructor\\"", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 22, + "line": 5, }, "start": Object { - "column": 15, - "line": 2, + "column": 21, + "line": 5, }, }, "range": Array [ - 29, - 30, + 122, + 123, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 23, + "line": 5, }, "start": Object { - "column": 16, - "line": 2, + "column": 22, + "line": 5, }, }, "range": Array [ - 30, - 31, + 123, + 124, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 24, + "line": 5, }, "start": Object { - "column": 17, - "line": 2, + "column": 23, + "line": 5, }, }, "range": Array [ - 31, - 32, + 124, + 125, ], "type": "Punctuator", - "value": ">", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 3, + "line": 6, }, "start": Object { - "column": 18, - "line": 2, + "column": 2, + "line": 6, }, }, "range": Array [ - 32, - 33, + 128, + 129, ], "type": "Punctuator", "value": "(", @@ -68005,233 +77462,269 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 6, + "line": 6, }, "start": Object { - "column": 19, - "line": 2, + "column": 3, + "line": 6, }, }, "range": Array [ - 33, - 34, + 129, + 132, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 7, + "line": 6, }, "start": Object { - "column": 20, - "line": 2, + "column": 6, + "line": 6, }, }, "range": Array [ - 34, - 35, + 132, + 133, ], "type": "Punctuator", - "value": ":", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 10, + "line": 6, }, "start": Object { - "column": 22, - "line": 2, + "column": 7, + "line": 6, }, }, "range": Array [ - 36, - 42, + 133, + 136, ], "type": "Identifier", - "value": "number", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 2, + "column": 12, + "line": 6, }, "start": Object { - "column": 29, - "line": 2, + "column": 10, + "line": 6, }, }, "range": Array [ - 43, - 44, + 136, + 138, ], "type": "Punctuator", - "value": "{", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 17, + "line": 6, }, "start": Object { - "column": 4, - "line": 3, + "column": 12, + "line": 6, }, }, "range": Array [ - 49, - 55, + 138, + 143, ], - "type": "Keyword", - "value": "return", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 19, + "line": 6, }, "start": Object { - "column": 11, - "line": 3, + "column": 17, + "line": 6, }, }, "range": Array [ - 56, - 57, + 143, + 145, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 21, + "line": 6, }, "start": Object { - "column": 2, - "line": 4, + "column": 19, + "line": 6, }, }, "range": Array [ - 60, - 61, + 145, + 147, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 21, + "line": 6, + }, + }, + "range": Array [ + 147, + 148, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 4, + "column": 23, + "line": 6, }, "start": Object { - "column": 3, - "line": 4, + "column": 22, + "line": 6, }, }, "range": Array [ - 61, - 62, + 148, + 149, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 24, + "line": 6, }, "start": Object { - "column": 2, - "line": 5, + "column": 23, + "line": 6, }, }, "range": Array [ - 65, - 68, + 149, + 150, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 5, + "column": 25, + "line": 6, }, "start": Object { - "column": 5, - "line": 5, + "column": 24, + "line": 6, }, }, "range": Array [ - 68, - 69, + 150, + 151, ], "type": "Punctuator", - "value": "<", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 3, + "line": 8, }, "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 155, + 156, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { "column": 6, - "line": 5, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, }, }, "range": Array [ - 69, - 70, + 156, + 159, ], "type": "Identifier", - "value": "T", + "value": "one", }, Object { "loc": Object { "end": Object { "column": 8, - "line": 5, + "line": 8, }, "start": Object { - "column": 7, - "line": 5, + "column": 6, + "line": 8, }, }, "range": Array [ - 70, - 71, + 159, + 161, ], "type": "Punctuator", - "value": ">", + "value": "?.", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 5, + "line": 8, }, "start": Object { "column": 8, - "line": 5, + "line": 8, }, }, "range": Array [ - 71, - 72, + 161, + 162, ], "type": "Punctuator", "value": "(", @@ -68240,16 +77733,16 @@ Object { "loc": Object { "end": Object { "column": 10, - "line": 5, + "line": 8, }, "start": Object { "column": 9, - "line": 5, + "line": 8, }, }, "range": Array [ - 72, - 73, + 162, + 163, ], "type": "Punctuator", "value": ")", @@ -68258,566 +77751,566 @@ Object { "loc": Object { "end": Object { "column": 11, - "line": 5, + "line": 8, }, "start": Object { "column": 10, - "line": 5, + "line": 8, }, }, "range": Array [ - 73, - 74, + 163, + 164, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 5, + "column": 12, + "line": 8, }, "start": Object { - "column": 12, - "line": 5, + "column": 11, + "line": 8, }, }, "range": Array [ - 75, - 81, + 164, + 165, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 5, + "column": 3, + "line": 9, }, "start": Object { - "column": 19, - "line": 5, + "column": 2, + "line": 9, }, }, "range": Array [ - 82, - 83, + 168, + 169, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 6, + "column": 6, + "line": 9, }, "start": Object { - "column": 4, - "line": 6, + "column": 3, + "line": 9, }, }, "range": Array [ - 88, - 94, + 169, + 172, ], - "type": "Keyword", - "value": "return", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 8, + "line": 9, }, "start": Object { - "column": 11, - "line": 6, + "column": 6, + "line": 9, }, }, "range": Array [ - 95, - 96, + 172, + 174, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 7, + "column": 9, + "line": 9, }, "start": Object { - "column": 2, - "line": 7, + "column": 8, + "line": 9, }, }, "range": Array [ - 99, - 100, + 174, + 175, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 7, + "column": 10, + "line": 9, }, "start": Object { - "column": 3, - "line": 7, + "column": 9, + "line": 9, }, }, "range": Array [ - 100, - 101, + 175, + 176, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 8, + "column": 11, + "line": 9, }, "start": Object { - "column": 2, - "line": 8, + "column": 10, + "line": 9, }, }, "range": Array [ - 104, - 107, + 176, + 177, ], - "type": "Identifier", - "value": "get", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 8, + "column": 12, + "line": 9, }, "start": Object { - "column": 6, - "line": 8, + "column": 11, + "line": 9, }, }, "range": Array [ - 108, - 109, + 177, + 178, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 8, + "column": 13, + "line": 9, }, "start": Object { - "column": 7, - "line": 8, + "column": 12, + "line": 9, }, }, "range": Array [ - 109, - 110, + 178, + 179, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 8, + "column": 14, + "line": 9, }, "start": Object { - "column": 8, - "line": 8, + "column": 13, + "line": 9, }, }, "range": Array [ - 110, - 111, + 179, + 180, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 8, + "column": 3, + "line": 10, }, "start": Object { - "column": 9, - "line": 8, + "column": 2, + "line": 10, }, }, "range": Array [ - 111, - 112, + 183, + 184, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 8, + "column": 6, + "line": 10, }, "start": Object { - "column": 11, - "line": 8, + "column": 3, + "line": 10, }, }, "range": Array [ - 113, - 119, + 184, + 187, ], "type": "Identifier", - "value": "number", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 8, + "column": 8, + "line": 10, }, "start": Object { - "column": 18, - "line": 8, + "column": 6, + "line": 10, }, }, "range": Array [ - 120, - 121, + 187, + 189, ], "type": "Punctuator", - "value": "{", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 9, + "column": 9, + "line": 10, }, "start": Object { - "column": 4, - "line": 9, + "column": 8, + "line": 10, }, }, "range": Array [ - 126, - 132, + 189, + 190, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 9, + "column": 10, + "line": 10, }, "start": Object { - "column": 11, - "line": 9, + "column": 9, + "line": 10, }, }, "range": Array [ - 133, - 134, + 190, + 191, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 11, "line": 10, }, "start": Object { - "column": 2, + "column": 10, "line": 10, }, }, "range": Array [ - 137, - 138, + 191, + 192, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 13, "line": 10, }, "start": Object { - "column": 3, + "column": 11, "line": 10, }, }, "range": Array [ - 138, - 139, + 192, + 194, ], "type": "Punctuator", - "value": ",", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 11, + "column": 14, + "line": 10, }, "start": Object { - "column": 2, - "line": 11, + "column": 13, + "line": 10, }, }, "range": Array [ - 142, - 145, + 194, + 195, ], - "type": "Identifier", - "value": "set", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 11, + "column": 15, + "line": 10, }, "start": Object { - "column": 6, - "line": 11, + "column": 14, + "line": 10, }, }, "range": Array [ - 146, - 147, + 195, + 196, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 11, + "column": 16, + "line": 10, }, "start": Object { - "column": 7, - "line": 11, + "column": 15, + "line": 10, }, }, "range": Array [ - 147, - 148, + 196, + 197, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 11, + "column": 3, + "line": 12, }, "start": Object { - "column": 8, - "line": 11, + "column": 2, + "line": 12, }, }, "range": Array [ - 148, - 149, + 201, + 202, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 11, + "column": 6, + "line": 12, }, "start": Object { - "column": 9, - "line": 11, + "column": 3, + "line": 12, }, }, "range": Array [ - 149, - 150, + 202, + 205, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 11, + "column": 8, + "line": 12, }, "start": Object { - "column": 11, - "line": 11, + "column": 6, + "line": 12, }, }, "range": Array [ - 151, - 157, + 205, + 207, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 11, + "column": 9, + "line": 12, }, "start": Object { - "column": 17, - "line": 11, + "column": 8, + "line": 12, }, }, "range": Array [ - 157, - 158, + 207, + 208, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 11, + "column": 10, + "line": 12, }, "start": Object { - "column": 18, - "line": 11, + "column": 9, + "line": 12, }, }, "range": Array [ - 158, - 159, + 208, + 209, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 11, + "column": 11, + "line": 12, }, "start": Object { - "column": 20, - "line": 11, + "column": 10, + "line": 12, }, }, "range": Array [ - 160, - 166, + 209, + 210, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 11, + "column": 12, + "line": 12, }, "start": Object { - "column": 27, - "line": 11, + "column": 11, + "line": 12, }, }, "range": Array [ - 167, - 168, + 210, + 211, ], "type": "Punctuator", - "value": "{", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 15, "line": 12, }, "start": Object { - "column": 2, + "column": 12, "line": 12, }, }, "range": Array [ - 171, - 172, + 211, + 214, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 13, + "column": 16, + "line": 12, }, "start": Object { - "column": 0, - "line": 13, + "column": 15, + "line": 12, }, }, "range": Array [ - 173, - 174, + 214, + 215, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 1, "line": 13, }, "start": Object { - "column": 1, + "column": 0, "line": 13, }, }, "range": Array [ - 174, - 175, + 216, + 217, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/optional-chain.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` Object { "body": Array [ Object { @@ -68826,7 +78319,7 @@ Object { "body": Array [ Object { "expression": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { "column": 10, @@ -68850,8 +78343,8 @@ Object { }, "name": "one", "range": Array [ - 40, - 43, + 47, + 50, ], "type": "Identifier", }, @@ -68859,24 +78352,25 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 10, + "column": 9, "line": 2, }, "start": Object { - "column": 7, + "column": 8, "line": 2, }, }, - "name": "two", "range": Array [ - 45, - 48, + 53, + 54, ], - "type": "Identifier", + "raw": "2", + "type": "Literal", + "value": 2, }, "range": Array [ - 40, - 48, + 47, + 55, ], "type": "OptionalMemberExpression", }, @@ -68891,17 +78385,17 @@ Object { }, }, "range": Array [ - 40, - 49, + 47, + 56, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { - "column": 16, + "column": 13, "line": 3, }, "start": Object { @@ -68910,7 +78404,7 @@ Object { }, }, "object": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { "column": 10, @@ -68934,8 +78428,8 @@ Object { }, "name": "one", "range": Array [ - 52, - 55, + 59, + 62, ], "type": "Identifier", }, @@ -68943,24 +78437,25 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 10, + "column": 9, "line": 3, }, "start": Object { - "column": 7, + "column": 8, "line": 3, }, }, - "name": "two", "range": Array [ - 57, - 60, + 65, + 66, ], - "type": "Identifier", + "raw": "2", + "type": "Literal", + "value": 2, }, "range": Array [ - 52, - 60, + 59, + 67, ], "type": "OptionalMemberExpression", }, @@ -68968,7 +78463,7 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 16, + "column": 12, "line": 3, }, "start": Object { @@ -68976,22 +78471,23 @@ Object { "line": 3, }, }, - "name": "three", "range": Array [ - 61, - 66, + 68, + 69, ], - "type": "Identifier", + "raw": "3", + "type": "Literal", + "value": 3, }, "range": Array [ - 52, - 66, + 59, + 70, ], "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 17, + "column": 14, "line": 3, }, "start": Object { @@ -69000,17 +78496,17 @@ Object { }, }, "range": Array [ - 52, - 67, + 59, + 71, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { - "column": 16, + "column": 13, "line": 4, }, "start": Object { @@ -69019,32 +78515,143 @@ Object { }, }, "object": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { - "column": 9, + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "one", + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 78, + 79, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 74, + 80, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, "line": 4, }, + }, + "range": Array [ + 83, + 84, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 74, + 85, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 86, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, "start": Object { "column": 2, - "line": 4, + "line": 5, }, }, "object": Object { "loc": Object { "end": Object { "column": 5, - "line": 4, + "line": 5, }, "start": Object { "column": 2, - "line": 4, + "line": 5, }, }, "name": "one", "range": Array [ - 70, - 73, + 89, + 92, ], "type": "Identifier", }, @@ -69052,24 +78659,25 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 7, + "line": 5, }, "start": Object { "column": 6, - "line": 4, + "line": 5, }, }, - "name": "two", "range": Array [ - 74, - 77, + 93, + 94, ], - "type": "Identifier", + "raw": "2", + "type": "Literal", + "value": 2, }, "range": Array [ - 70, - 77, + 89, + 95, ], "type": "MemberExpression", }, @@ -69077,95 +78685,96 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 12, + "line": 5, }, "start": Object { "column": 11, - "line": 4, + "line": 5, }, }, - "name": "three", "range": Array [ - 79, - 84, + 98, + 99, ], - "type": "Identifier", + "raw": "3", + "type": "Literal", + "value": 3, }, "range": Array [ - 70, - 84, + 89, + 100, ], "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 14, + "line": 5, }, "start": Object { "column": 2, - "line": 4, + "line": 5, }, }, "range": Array [ - 70, - 85, + 89, + 101, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { - "column": 21, - "line": 5, + "column": 16, + "line": 6, }, "start": Object { "column": 2, - "line": 5, + "line": 6, }, }, "object": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 13, + "line": 6, }, "start": Object { "column": 2, - "line": 5, + "line": 6, }, }, "object": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 8, + "line": 6, }, "start": Object { "column": 2, - "line": 5, + "line": 6, }, }, "object": Object { "loc": Object { "end": Object { "column": 5, - "line": 5, + "line": 6, }, "start": Object { "column": 2, - "line": 5, + "line": 6, }, }, "name": "one", "range": Array [ - 88, - 91, + 104, + 107, ], "type": "Identifier", }, @@ -69173,24 +78782,25 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 7, + "line": 6, }, "start": Object { "column": 6, - "line": 5, + "line": 6, }, }, - "name": "two", "range": Array [ - 92, - 95, + 108, + 109, ], - "type": "Identifier", + "raw": "2", + "type": "Literal", + "value": 2, }, "range": Array [ - 88, - 95, + 104, + 110, ], "type": "MemberExpression", }, @@ -69198,24 +78808,25 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 12, + "line": 6, }, "start": Object { "column": 11, - "line": 5, + "line": 6, }, }, - "name": "three", "range": Array [ - 97, - 102, + 113, + 114, ], - "type": "Identifier", + "raw": "3", + "type": "Literal", + "value": 3, }, "range": Array [ - 88, - 102, + 104, + 115, ], "type": "OptionalMemberExpression", }, @@ -69223,95 +78834,96 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 21, - "line": 5, + "column": 15, + "line": 6, }, "start": Object { - "column": 17, - "line": 5, + "column": 14, + "line": 6, }, }, - "name": "four", "range": Array [ - 103, - 107, + 116, + 117, ], - "type": "Identifier", + "raw": "4", + "type": "Literal", + "value": 4, }, "range": Array [ - 88, - 107, + 104, + 118, ], "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 22, - "line": 5, + "column": 17, + "line": 6, }, "start": Object { "column": 2, - "line": 5, + "line": 6, }, }, "range": Array [ - 88, - 108, + 104, + 119, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { - "column": 22, - "line": 6, + "column": 18, + "line": 7, }, "start": Object { "column": 2, - "line": 6, + "line": 7, }, }, "object": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { - "column": 16, - "line": 6, + "column": 13, + "line": 7, }, "start": Object { "column": 2, - "line": 6, + "line": 7, }, }, "object": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { - "column": 9, - "line": 6, + "column": 8, + "line": 7, }, "start": Object { "column": 2, - "line": 6, + "line": 7, }, }, "object": Object { "loc": Object { "end": Object { "column": 5, - "line": 6, + "line": 7, }, "start": Object { "column": 2, - "line": 6, + "line": 7, }, }, "name": "one", "range": Array [ - 111, - 114, + 122, + 125, ], "type": "Identifier", }, @@ -69319,24 +78931,25 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 9, - "line": 6, + "column": 7, + "line": 7, }, "start": Object { "column": 6, - "line": 6, + "line": 7, }, }, - "name": "two", "range": Array [ - 115, - 118, + 126, + 127, ], - "type": "Identifier", + "raw": "2", + "type": "Literal", + "value": 2, }, "range": Array [ - 111, - 118, + 122, + 128, ], "type": "MemberExpression", }, @@ -69344,24 +78957,25 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 16, - "line": 6, + "column": 12, + "line": 7, }, "start": Object { "column": 11, - "line": 6, + "line": 7, }, }, - "name": "three", "range": Array [ - 120, - 125, + 131, + 132, ], - "type": "Identifier", + "raw": "3", + "type": "Literal", + "value": 3, }, "range": Array [ - 111, - 125, + 122, + 133, ], "type": "OptionalMemberExpression", }, @@ -69369,40 +78983,41 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 22, - "line": 6, + "column": 17, + "line": 7, }, "start": Object { - "column": 18, - "line": 6, + "column": 16, + "line": 7, }, }, - "name": "four", "range": Array [ - 127, - 131, + 136, + 137, ], - "type": "Identifier", + "raw": "4", + "type": "Literal", + "value": 4, }, "range": Array [ - 111, - 131, + 122, + 138, ], "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 23, - "line": 6, + "column": 19, + "line": 7, }, "start": Object { "column": 2, - "line": 6, + "line": 7, }, }, "range": Array [ - 111, - 132, + 122, + 139, ], "type": "ExpressionStatement", }, @@ -69410,16 +79025,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 8, }, "start": Object { - "column": 36, + "column": 43, "line": 1, }, }, "range": Array [ - 36, - 134, + 43, + 141, ], "type": "BlockStatement", }, @@ -69428,7 +79043,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 24, + "column": 31, "line": 1, }, "start": Object { @@ -69436,17 +79051,17 @@ Object { "line": 1, }, }, - "name": "processOptional", + "name": "processOptionalElement", "range": Array [ 9, - 24, + 31, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 8, }, "start": Object { "column": 0, @@ -69457,51 +79072,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 41, "line": 1, }, "start": Object { - "column": 25, + "column": 32, "line": 1, }, }, "name": "one", "optional": true, "range": Array [ - 25, - 34, + 32, + 41, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, + "column": 41, "line": 1, }, "start": Object { - "column": 29, + "column": 36, "line": 1, }, }, "range": Array [ - 29, - 34, + 36, + 41, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, + "column": 41, "line": 1, }, "start": Object { - "column": 31, + "column": 38, "line": 1, }, }, "range": Array [ - 31, - 34, + 38, + 41, ], "type": "TSAnyKeyword", }, @@ -69510,7 +79125,7 @@ Object { ], "range": Array [ 0, - 134, + 141, ], "type": "FunctionDeclaration", }, @@ -69518,7 +79133,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 8, + "line": 9, }, "start": Object { "column": 0, @@ -69527,7 +79142,7 @@ Object { }, "range": Array [ 0, - 135, + 142, ], "sourceType": "script", "tokens": Array [ @@ -69552,7 +79167,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 31, "line": 1, }, "start": Object { @@ -69562,25 +79177,25 @@ Object { }, "range": Array [ 9, - 24, + 31, ], "type": "Identifier", - "value": "processOptional", + "value": "processOptionalElement", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 32, "line": 1, }, "start": Object { - "column": 24, + "column": 31, "line": 1, }, }, "range": Array [ - 24, - 25, + 31, + 32, ], "type": "Punctuator", "value": "(", @@ -69588,17 +79203,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 35, "line": 1, }, "start": Object { - "column": 25, + "column": 32, "line": 1, }, }, "range": Array [ - 25, - 28, + 32, + 35, ], "type": "Identifier", "value": "one", @@ -69606,17 +79221,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 36, "line": 1, }, "start": Object { - "column": 28, + "column": 35, "line": 1, }, }, "range": Array [ - 28, - 29, + 35, + 36, ], "type": "Punctuator", "value": "?", @@ -69624,17 +79239,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 37, "line": 1, }, "start": Object { - "column": 29, + "column": 36, "line": 1, }, }, "range": Array [ - 29, - 30, + 36, + 37, ], "type": "Punctuator", "value": ":", @@ -69642,17 +79257,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 41, "line": 1, }, "start": Object { - "column": 31, + "column": 38, "line": 1, }, }, "range": Array [ - 31, - 34, + 38, + 41, ], "type": "Identifier", "value": "any", @@ -69660,17 +79275,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 42, "line": 1, }, "start": Object { - "column": 34, + "column": 41, "line": 1, }, }, "range": Array [ - 34, - 35, + 41, + 42, ], "type": "Punctuator", "value": ")", @@ -69678,17 +79293,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, + "column": 44, "line": 1, }, "start": Object { - "column": 36, + "column": 43, "line": 1, }, }, "range": Array [ - 36, - 37, + 43, + 44, ], "type": "Punctuator", "value": "{", @@ -69705,8 +79320,8 @@ Object { }, }, "range": Array [ - 40, - 43, + 47, + 50, ], "type": "Identifier", "value": "one", @@ -69723,8 +79338,8 @@ Object { }, }, "range": Array [ - 43, - 45, + 50, + 52, ], "type": "Punctuator", "value": "?.", @@ -69732,7 +79347,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 2, }, "start": Object { @@ -69741,11 +79356,47 @@ Object { }, }, "range": Array [ - 45, - 48, + 52, + 53, ], - "type": "Identifier", - "value": "two", + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { @@ -69759,8 +79410,8 @@ Object { }, }, "range": Array [ - 48, - 49, + 55, + 56, ], "type": "Punctuator", "value": ";", @@ -69777,8 +79428,8 @@ Object { }, }, "range": Array [ - 52, - 55, + 59, + 62, ], "type": "Identifier", "value": "one", @@ -69795,8 +79446,8 @@ Object { }, }, "range": Array [ - 55, - 57, + 62, + 64, ], "type": "Punctuator", "value": "?.", @@ -69804,7 +79455,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 3, }, "start": Object { @@ -69813,11 +79464,47 @@ Object { }, }, "range": Array [ - 57, - 60, + 64, + 65, ], - "type": "Identifier", - "value": "two", + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { @@ -69831,16 +79518,16 @@ Object { }, }, "range": Array [ - 60, - 61, + 67, + 68, ], "type": "Punctuator", - "value": ".", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 12, "line": 3, }, "start": Object { @@ -69849,26 +79536,44 @@ Object { }, }, "range": Array [ - 61, - 66, + 68, + 69, ], - "type": "Identifier", - "value": "three", + "type": "Numeric", + "value": "3", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 13, "line": 3, }, "start": Object { - "column": 16, + "column": 12, "line": 3, }, }, "range": Array [ - 66, - 67, + 69, + 70, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, ], "type": "Punctuator", "value": ";", @@ -69885,8 +79590,8 @@ Object { }, }, "range": Array [ - 70, - 73, + 74, + 77, ], "type": "Identifier", "value": "one", @@ -69903,16 +79608,16 @@ Object { }, }, "range": Array [ - 73, - 74, + 77, + 78, ], "type": "Punctuator", - "value": ".", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 4, }, "start": Object { @@ -69921,26 +79626,44 @@ Object { }, }, "range": Array [ - 74, - 77, + 78, + 79, ], - "type": "Identifier", - "value": "two", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 8, "line": 4, }, "start": Object { - "column": 9, + "column": 7, "line": 4, }, }, "range": Array [ - 77, 79, + 80, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 80, + 82, ], "type": "Punctuator", "value": "?.", @@ -69948,7 +79671,25 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, "line": 4, }, "start": Object { @@ -69957,20 +79698,20 @@ Object { }, }, "range": Array [ - 79, + 83, 84, ], - "type": "Identifier", - "value": "three", + "type": "Numeric", + "value": "3", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 13, "line": 4, }, "start": Object { - "column": 16, + "column": 12, "line": 4, }, }, @@ -69979,6 +79720,24 @@ Object { 85, ], "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", "value": ";", }, Object { @@ -69993,8 +79752,8 @@ Object { }, }, "range": Array [ - 88, - 91, + 89, + 92, ], "type": "Identifier", "value": "one", @@ -70011,16 +79770,16 @@ Object { }, }, "range": Array [ - 91, 92, + 93, ], "type": "Punctuator", - "value": ".", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 5, }, "start": Object { @@ -70029,20 +79788,38 @@ Object { }, }, "range": Array [ - 92, + 93, + 94, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 94, 95, ], - "type": "Identifier", - "value": "two", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 5, }, "start": Object { - "column": 9, + "column": 8, "line": 5, }, }, @@ -70056,71 +79833,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 5, }, "start": Object { - "column": 11, + "column": 10, "line": 5, }, }, "range": Array [ 97, - 102, + 98, ], - "type": "Identifier", - "value": "three", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 12, "line": 5, }, "start": Object { - "column": 16, + "column": 11, "line": 5, }, }, "range": Array [ - 102, - 103, + 98, + 99, ], - "type": "Punctuator", - "value": ".", + "type": "Numeric", + "value": "3", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 13, "line": 5, }, "start": Object { - "column": 17, + "column": 12, "line": 5, }, }, "range": Array [ - 103, - 107, + 99, + 100, ], - "type": "Identifier", - "value": "four", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 14, "line": 5, }, "start": Object { - "column": 21, + "column": 13, "line": 5, }, }, "range": Array [ - 107, - 108, + 100, + 101, ], "type": "Punctuator", "value": ";", @@ -70137,8 +79914,8 @@ Object { }, }, "range": Array [ - 111, - 114, + 104, + 107, ], "type": "Identifier", "value": "one", @@ -70154,117 +79931,423 @@ Object { "line": 6, }, }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 110, + 112, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, "range": Array [ 114, 115, ], "type": "Punctuator", - "value": ".", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 14, "line": 6, }, "start": Object { - "column": 6, + "column": 13, "line": 6, }, }, "range": Array [ 115, - 118, + 116, ], - "type": "Identifier", - "value": "two", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 15, "line": 6, }, "start": Object { - "column": 9, + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 15, "line": 6, }, }, "range": Array [ + 117, 118, - 120, ], "type": "Punctuator", - "value": "?.", + "value": "]", }, Object { "loc": Object { "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { "column": 16, "line": 6, }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 128, + 130, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { "column": 11, - "line": 6, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 133, + 135, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, }, }, "range": Array [ - 120, - 125, + 135, + 136, ], - "type": "Identifier", - "value": "three", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 6, + "column": 17, + "line": 7, }, "start": Object { "column": 16, - "line": 6, + "line": 7, }, }, "range": Array [ - 125, - 127, + 136, + 137, ], - "type": "Punctuator", - "value": "?.", + "type": "Numeric", + "value": "4", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 6, + "column": 18, + "line": 7, }, "start": Object { - "column": 18, - "line": 6, + "column": 17, + "line": 7, }, }, "range": Array [ - 127, - 131, + 137, + 138, ], - "type": "Identifier", - "value": "four", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 6, + "column": 19, + "line": 7, }, "start": Object { - "column": 22, - "line": 6, + "column": 18, + "line": 7, }, }, "range": Array [ - 131, - 132, + 138, + 139, ], "type": "Punctuator", "value": ";", @@ -70273,16 +80356,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 8, }, "start": Object { "column": 0, - "line": 7, + "line": 8, }, }, "range": Array [ - 133, - 134, + 140, + 141, ], "type": "Punctuator", "value": "}", @@ -70292,7 +80375,7 @@ Object { } `; -exports[`typescript fixtures/basics/optional-chain-call.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-element-access-with-parens.src 1`] = ` Object { "body": Array [ Object { @@ -70301,82 +80384,64 @@ Object { "body": Array [ Object { "expression": Object { - "arguments": Array [], - "callee": Object { - "computed": false, + "computed": true, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "object": Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 2, }, "start": Object { - "column": 2, + "column": 3, "line": 2, }, }, - "object": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, + "name": "one", + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, }, - "name": "one", - "range": Array [ - 44, - 47, - ], - "type": "Identifier", - }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, + "start": Object { + "column": 9, + "line": 2, }, - "name": "fn", - "range": Array [ - 49, - 51, - ], - "type": "Identifier", }, "range": Array [ - 44, - 51, + 60, + 61, ], - "type": "OptionalMemberExpression", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, + "raw": "2", + "type": "Literal", + "value": 2, }, - "optional": false, "range": Array [ - 44, - 53, + 54, + 62, ], - "type": "OptionalCallExpression", + "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 2, }, "start": Object { @@ -70385,122 +80450,105 @@ Object { }, }, "range": Array [ - 44, - 54, + 53, + 64, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "arguments": Array [], - "callee": Object { - "computed": false, + "computed": true, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "computed": true, "loc": Object { "end": Object { - "column": 13, + "column": 11, "line": 3, }, "start": Object { - "column": 2, + "column": 3, "line": 3, }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { - "column": 10, + "column": 6, "line": 3, }, "start": Object { - "column": 2, + "column": 3, "line": 3, }, }, - "object": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "name": "one", - "range": Array [ - 57, - 60, - ], - "type": "Identifier", - }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "name": "two", - "range": Array [ - 62, - 65, - ], - "type": "Identifier", - }, + "name": "one", "range": Array [ - 57, - 65, + 68, + 71, ], - "type": "OptionalMemberExpression", + "type": "Identifier", }, - "optional": false, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 3, }, "start": Object { - "column": 11, + "column": 9, "line": 3, }, }, - "name": "fn", "range": Array [ - 66, - 68, + 74, + 75, ], - "type": "Identifier", + "raw": "2", + "type": "Literal", + "value": 2, }, "range": Array [ - 57, 68, + 76, ], "type": "OptionalMemberExpression", }, - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, }, + "range": Array [ + 78, + 79, + ], + "raw": "3", + "type": "Literal", + "value": 3, }, - "optional": false, "range": Array [ - 57, - 70, + 67, + 80, ], - "type": "OptionalCallExpression", + "type": "MemberExpression", }, "loc": Object { "end": Object { @@ -70513,122 +80561,105 @@ Object { }, }, "range": Array [ - 57, - 71, + 67, + 81, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "arguments": Array [], - "callee": Object { - "computed": false, + "computed": true, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "computed": true, "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 4, }, "start": Object { - "column": 2, + "column": 3, "line": 4, }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 4, }, "start": Object { - "column": 2, + "column": 3, "line": 4, }, }, - "object": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "name": "one", - "range": Array [ - 74, - 77, - ], - "type": "Identifier", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, - }, - }, - "name": "two", - "range": Array [ - 78, - 81, - ], - "type": "Identifier", - }, + "name": "one", "range": Array [ - 74, - 81, + 85, + 88, ], - "type": "MemberExpression", + "type": "Identifier", }, - "optional": true, + "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 4, }, "start": Object { - "column": 11, + "column": 7, "line": 4, }, }, - "name": "fn", "range": Array [ - 83, - 85, + 89, + 90, ], - "type": "Identifier", + "raw": "2", + "type": "Literal", + "value": 2, }, "range": Array [ - 74, 85, + 91, ], - "type": "OptionalMemberExpression", + "type": "MemberExpression", }, - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, }, + "range": Array [ + 94, + 95, + ], + "raw": "3", + "type": "Literal", + "value": 3, }, - "optional": false, "range": Array [ - 74, - 87, + 85, + 96, ], - "type": "OptionalCallExpression", + "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { @@ -70641,163 +80672,147 @@ Object { }, }, "range": Array [ - 74, - 88, + 84, + 98, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "arguments": Array [], - "callee": Object { - "computed": false, + "computed": true, + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": true, "loc": Object { "end": Object { - "column": 19, + "column": 14, "line": 5, }, "start": Object { - "column": 2, + "column": 3, "line": 5, }, }, "object": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { - "column": 16, + "column": 9, "line": 5, }, "start": Object { - "column": 2, + "column": 3, "line": 5, }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 5, }, "start": Object { - "column": 2, + "column": 3, "line": 5, }, }, - "object": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "name": "one", - "range": Array [ - 91, - 94, - ], - "type": "Identifier", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "name": "two", - "range": Array [ - 95, - 98, - ], - "type": "Identifier", - }, + "name": "one", "range": Array [ - 91, - 98, + 102, + 105, ], - "type": "MemberExpression", + "type": "Identifier", }, - "optional": true, + "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 16, + "column": 8, "line": 5, }, "start": Object { - "column": 11, + "column": 7, "line": 5, }, }, - "name": "three", "range": Array [ - 100, - 105, + 106, + 107, ], - "type": "Identifier", + "raw": "2", + "type": "Literal", + "value": 2, }, "range": Array [ - 91, - 105, + 102, + 108, ], - "type": "OptionalMemberExpression", + "type": "MemberExpression", }, - "optional": false, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 19, + "column": 13, "line": 5, }, "start": Object { - "column": 17, + "column": 12, "line": 5, }, }, - "name": "fn", "range": Array [ - 106, - 108, + 111, + 112, ], - "type": "Identifier", + "raw": "3", + "type": "Literal", + "value": 3, }, "range": Array [ - 91, - 108, + 102, + 113, ], "type": "OptionalMemberExpression", }, - "loc": Object { - "end": Object { - "column": 21, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 5, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, }, + "range": Array [ + 115, + 116, + ], + "raw": "4", + "type": "Literal", + "value": 4, }, - "optional": false, "range": Array [ - 91, - 110, + 101, + 117, ], - "type": "OptionalCallExpression", + "type": "MemberExpression", }, "loc": Object { "end": Object { - "column": 22, + "column": 19, "line": 5, }, "start": Object { @@ -70806,163 +80821,147 @@ Object { }, }, "range": Array [ - 91, - 111, + 101, + 118, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "arguments": Array [], - "callee": Object { - "computed": false, + "computed": true, + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": true, "loc": Object { "end": Object { - "column": 20, + "column": 14, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, "object": Object { - "computed": false, + "computed": true, "loc": Object { "end": Object { - "column": 16, + "column": 9, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, - "object": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 6, - }, - "start": Object { - "column": 2, - "line": 6, - }, - }, - "name": "one", - "range": Array [ - 114, - 117, - ], - "type": "Identifier", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 6, - }, - "start": Object { - "column": 6, - "line": 6, - }, - }, - "name": "two", - "range": Array [ - 118, - 121, - ], - "type": "Identifier", - }, + "name": "one", "range": Array [ - 114, - 121, + 122, + 125, ], - "type": "MemberExpression", + "type": "Identifier", }, - "optional": true, + "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 16, + "column": 8, "line": 6, }, "start": Object { - "column": 11, + "column": 7, "line": 6, }, }, - "name": "three", "range": Array [ - 123, - 128, + 126, + 127, ], - "type": "Identifier", + "raw": "2", + "type": "Literal", + "value": 2, }, "range": Array [ - 114, + 122, 128, ], - "type": "OptionalMemberExpression", + "type": "MemberExpression", }, "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 20, + "column": 13, "line": 6, }, "start": Object { - "column": 18, + "column": 12, "line": 6, }, }, - "name": "fn", "range": Array [ - 130, + 131, 132, ], - "type": "Identifier", + "raw": "3", + "type": "Literal", + "value": 3, }, "range": Array [ - 114, - 132, + 122, + 133, ], "type": "OptionalMemberExpression", }, - "loc": Object { - "end": Object { - "column": 22, - "line": 6, - }, - "start": Object { - "column": 2, - "line": 6, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, }, + "range": Array [ + 136, + 137, + ], + "raw": "4", + "type": "Literal", + "value": 4, }, - "optional": false, "range": Array [ - 114, - 134, + 122, + 138, ], - "type": "OptionalCallExpression", + "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 23, + "column": 21, "line": 6, }, "start": Object { @@ -70971,226 +80970,195 @@ Object { }, }, "range": Array [ - 114, - 135, + 121, + 140, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 8, - }, - "start": Object { - "column": 2, - "line": 8, - }, - }, - "name": "one", - "range": Array [ - 139, - 142, - ], - "type": "Identifier", - }, + "computed": true, "loc": Object { "end": Object { - "column": 9, - "line": 8, + "column": 23, + "line": 7, }, "start": Object { "column": 2, - "line": 8, + "line": 7, }, }, - "optional": true, - "range": Array [ - 139, - 146, - ], - "type": "OptionalCallExpression", - }, - "loc": Object { - "end": Object { - "column": 10, - "line": 8, - }, - "start": Object { - "column": 2, - "line": 8, - }, - }, - "range": Array [ - 139, - 147, - ], - "type": "ExpressionStatement", - }, - Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "arguments": Array [], - "callee": Object { + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "computed": true, "loc": Object { "end": Object { - "column": 5, - "line": 9, + "column": 14, + "line": 7, }, "start": Object { - "column": 2, - "line": 9, + "column": 3, + "line": 7, }, }, - "name": "one", - "range": Array [ - 150, - 153, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 9, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "name": "one", + "range": Array [ + 144, + 147, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 148, + 149, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 144, + 150, + ], + "type": "MemberExpression", }, - "start": Object { - "column": 2, - "line": 9, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 153, + 154, + ], + "raw": "3", + "type": "Literal", + "value": 3, }, + "range": Array [ + 144, + 155, + ], + "type": "OptionalMemberExpression", }, "optional": true, - "range": Array [ - 150, - 157, - ], - "type": "OptionalCallExpression", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 9, - }, - "start": Object { - "column": 2, - "line": 9, - }, - }, - "optional": true, - "range": Array [ - 150, - 161, - ], - "type": "OptionalCallExpression", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 9, - }, - "start": Object { - "column": 2, - "line": 9, - }, - }, - "range": Array [ - 150, - 162, - ], - "type": "ExpressionStatement", - }, - Object { - "expression": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 13, - "line": 11, - }, - "start": Object { - "column": 2, - "line": 11, - }, - }, - "object": Object { - "arguments": Array [], - "callee": Object { + "property": Object { "loc": Object { "end": Object { - "column": 5, - "line": 11, + "column": 18, + "line": 7, }, "start": Object { - "column": 2, - "line": 11, + "column": 17, + "line": 7, }, }, - "name": "one", "range": Array [ - 166, - 169, + 158, + 159, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 11, - }, - "start": Object { - "column": 2, - "line": 11, - }, + "raw": "4", + "type": "Literal", + "value": 4, }, - "optional": true, "range": Array [ - 166, - 173, + 144, + 160, ], - "type": "OptionalCallExpression", + "type": "OptionalMemberExpression", }, "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 13, - "line": 11, + "column": 22, + "line": 7, }, "start": Object { - "column": 10, - "line": 11, + "column": 21, + "line": 7, }, }, - "name": "two", "range": Array [ - 174, - 177, + 162, + 163, ], - "type": "Identifier", + "raw": "5", + "type": "Literal", + "value": 5, }, "range": Array [ - 166, - 177, + 143, + 164, ], - "type": "OptionalMemberExpression", + "type": "MemberExpression", }, "loc": Object { "end": Object { - "column": 14, - "line": 11, + "column": 24, + "line": 7, }, "start": Object { "column": 2, - "line": 11, + "line": 7, }, }, "range": Array [ - 166, - 178, + 143, + 165, ], "type": "ExpressionStatement", }, @@ -71198,16 +81166,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 12, + "line": 8, }, "start": Object { - "column": 40, + "column": 49, "line": 1, }, }, "range": Array [ - 40, - 180, + 49, + 167, ], "type": "BlockStatement", }, @@ -71216,7 +81184,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 28, + "column": 37, "line": 1, }, "start": Object { @@ -71224,17 +81192,17 @@ Object { "line": 1, }, }, - "name": "processOptionalCall", + "name": "processOptionalElementParens", "range": Array [ 9, - 28, + 37, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 12, + "line": 8, }, "start": Object { "column": 0, @@ -71245,51 +81213,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 47, "line": 1, }, "start": Object { - "column": 29, + "column": 38, "line": 1, }, }, "name": "one", "optional": true, "range": Array [ - 29, 38, + 47, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 47, "line": 1, }, "start": Object { - "column": 33, + "column": 42, "line": 1, }, }, "range": Array [ - 33, - 38, + 42, + 47, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, + "column": 47, "line": 1, }, "start": Object { - "column": 35, + "column": 44, "line": 1, }, }, "range": Array [ - 35, - 38, + 44, + 47, ], "type": "TSAnyKeyword", }, @@ -71298,7 +81266,7 @@ Object { ], "range": Array [ 0, - 180, + 167, ], "type": "FunctionDeclaration", }, @@ -71306,7 +81274,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 13, + "line": 9, }, "start": Object { "column": 0, @@ -71315,7 +81283,7 @@ Object { }, "range": Array [ 0, - 181, + 168, ], "sourceType": "script", "tokens": Array [ @@ -71340,7 +81308,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 37, "line": 1, }, "start": Object { @@ -71350,25 +81318,25 @@ Object { }, "range": Array [ 9, - 28, + 37, ], "type": "Identifier", - "value": "processOptionalCall", + "value": "processOptionalElementParens", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 38, "line": 1, }, "start": Object { - "column": 28, + "column": 37, "line": 1, }, }, "range": Array [ - 28, - 29, + 37, + 38, ], "type": "Punctuator", "value": "(", @@ -71376,17 +81344,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 41, "line": 1, }, "start": Object { - "column": 29, + "column": 38, "line": 1, }, }, "range": Array [ - 29, - 32, + 38, + 41, ], "type": "Identifier", "value": "one", @@ -71394,17 +81362,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 42, "line": 1, }, "start": Object { - "column": 32, + "column": 41, "line": 1, }, }, "range": Array [ - 32, - 33, + 41, + 42, ], "type": "Punctuator", "value": "?", @@ -71412,17 +81380,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 43, "line": 1, }, "start": Object { - "column": 33, + "column": 42, "line": 1, }, }, "range": Array [ - 33, - 34, + 42, + 43, ], "type": "Punctuator", "value": ":", @@ -71430,17 +81398,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 47, "line": 1, }, "start": Object { - "column": 35, + "column": 44, "line": 1, }, }, "range": Array [ - 35, - 38, + 44, + 47, ], "type": "Identifier", "value": "any", @@ -71448,17 +81416,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, + "column": 48, "line": 1, }, "start": Object { - "column": 38, + "column": 47, "line": 1, }, }, "range": Array [ - 38, - 39, + 47, + 48, ], "type": "Punctuator", "value": ")", @@ -71466,17 +81434,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 50, "line": 1, }, "start": Object { - "column": 40, + "column": 49, "line": 1, }, }, "range": Array [ - 40, - 41, + 49, + 50, ], "type": "Punctuator", "value": "{", @@ -71484,7 +81452,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 2, }, "start": Object { @@ -71493,8 +81461,26 @@ Object { }, }, "range": Array [ - 44, - 47, + 53, + 54, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 54, + 57, ], "type": "Identifier", "value": "one", @@ -71502,17 +81488,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 8, "line": 2, }, "start": Object { - "column": 5, + "column": 6, "line": 2, }, }, "range": Array [ - 47, - 49, + 57, + 59, ], "type": "Punctuator", "value": "?.", @@ -71524,16 +81510,16 @@ Object { "line": 2, }, "start": Object { - "column": 7, + "column": 8, "line": 2, }, }, "range": Array [ - 49, - 51, + 59, + 60, ], - "type": "Identifier", - "value": "fn", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { @@ -71547,11 +81533,11 @@ Object { }, }, "range": Array [ - 51, - 52, + 60, + 61, ], - "type": "Punctuator", - "value": "(", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { @@ -71565,11 +81551,11 @@ Object { }, }, "range": Array [ - 52, - 53, + 61, + 62, ], "type": "Punctuator", - "value": ")", + "value": "]", }, Object { "loc": Object { @@ -71583,8 +81569,26 @@ Object { }, }, "range": Array [ - 53, - 54, + 62, + 63, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 63, + 64, ], "type": "Punctuator", "value": ";", @@ -71592,7 +81596,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 3, }, "start": Object { @@ -71601,8 +81605,26 @@ Object { }, }, "range": Array [ - 57, - 60, + 67, + 68, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 68, + 71, ], "type": "Identifier", "value": "one", @@ -71610,21 +81632,39 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 8, "line": 3, }, "start": Object { - "column": 5, + "column": 6, "line": 3, }, }, "range": Array [ - 60, - 62, + 71, + 73, ], "type": "Punctuator", "value": "?.", }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "[", + }, Object { "loc": Object { "end": Object { @@ -71632,16 +81672,16 @@ Object { "line": 3, }, "start": Object { - "column": 7, + "column": 9, "line": 3, }, }, "range": Array [ - 62, - 65, + 74, + 75, ], - "type": "Identifier", - "value": "two", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { @@ -71655,16 +81695,16 @@ Object { }, }, "range": Array [ - 65, - 66, + 75, + 76, ], "type": "Punctuator", - "value": ".", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 3, }, "start": Object { @@ -71673,11 +81713,29 @@ Object { }, }, "range": Array [ - 66, - 68, + 76, + 77, ], - "type": "Identifier", - "value": "fn", + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { @@ -71691,11 +81749,11 @@ Object { }, }, "range": Array [ - 68, - 69, + 78, + 79, ], - "type": "Punctuator", - "value": "(", + "type": "Numeric", + "value": "3", }, Object { "loc": Object { @@ -71709,11 +81767,11 @@ Object { }, }, "range": Array [ - 69, - 70, + 79, + 80, ], "type": "Punctuator", - "value": ")", + "value": "]", }, Object { "loc": Object { @@ -71727,8 +81785,8 @@ Object { }, }, "range": Array [ - 70, - 71, + 80, + 81, ], "type": "Punctuator", "value": ";", @@ -71736,7 +81794,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 4, }, "start": Object { @@ -71745,8 +81803,26 @@ Object { }, }, "range": Array [ - 74, - 77, + 84, + 85, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 85, + 88, ], "type": "Identifier", "value": "one", @@ -71754,20 +81830,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 7, "line": 4, }, "start": Object { - "column": 5, + "column": 6, "line": 4, }, }, "range": Array [ - 77, - 78, + 88, + 89, ], "type": "Punctuator", - "value": ".", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Numeric", + "value": "2", }, Object { "loc": Object { @@ -71776,16 +81870,16 @@ Object { "line": 4, }, "start": Object { - "column": 6, + "column": 8, "line": 4, }, }, "range": Array [ - 78, - 81, + 90, + 91, ], - "type": "Identifier", - "value": "two", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { @@ -71799,8 +81893,8 @@ Object { }, }, "range": Array [ - 81, - 83, + 91, + 93, ], "type": "Punctuator", "value": "?.", @@ -71808,7 +81902,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 4, }, "start": Object { @@ -71817,11 +81911,29 @@ Object { }, }, "range": Array [ - 83, - 85, + 93, + 94, ], - "type": "Identifier", - "value": "fn", + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Numeric", + "value": "3", }, Object { "loc": Object { @@ -71835,11 +81947,11 @@ Object { }, }, "range": Array [ - 85, - 86, + 95, + 96, ], "type": "Punctuator", - "value": "(", + "value": "]", }, Object { "loc": Object { @@ -71853,8 +81965,8 @@ Object { }, }, "range": Array [ - 86, - 87, + 96, + 97, ], "type": "Punctuator", "value": ")", @@ -71871,8 +81983,8 @@ Object { }, }, "range": Array [ - 87, - 88, + 97, + 98, ], "type": "Punctuator", "value": ";", @@ -71880,7 +81992,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 5, }, "start": Object { @@ -71889,8 +82001,26 @@ Object { }, }, "range": Array [ - 91, - 94, + 101, + 102, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 102, + 105, ], "type": "Identifier", "value": "one", @@ -71898,20 +82028,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 7, "line": 5, }, "start": Object { - "column": 5, + "column": 6, "line": 5, }, }, "range": Array [ - 94, - 95, + 105, + 106, ], "type": "Punctuator", - "value": ".", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Numeric", + "value": "2", }, Object { "loc": Object { @@ -71920,16 +82068,16 @@ Object { "line": 5, }, "start": Object { - "column": 6, + "column": 8, "line": 5, }, }, "range": Array [ - 95, - 98, + 107, + 108, ], - "type": "Identifier", - "value": "two", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { @@ -71943,8 +82091,8 @@ Object { }, }, "range": Array [ - 98, - 100, + 108, + 110, ], "type": "Punctuator", "value": "?.", @@ -71952,7 +82100,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 12, "line": 5, }, "start": Object { @@ -71961,98 +82109,134 @@ Object { }, }, "range": Array [ - 100, - 105, + 110, + 111, ], - "type": "Identifier", - "value": "three", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 13, "line": 5, }, "start": Object { - "column": 16, + "column": 12, "line": 5, }, }, "range": Array [ - 105, - 106, + 111, + 112, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 112, + 113, ], "type": "Punctuator", - "value": ".", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 15, "line": 5, }, "start": Object { - "column": 17, + "column": 14, "line": 5, }, }, "range": Array [ - 106, - 108, + 113, + 114, ], - "type": "Identifier", - "value": "fn", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 16, "line": 5, }, "start": Object { - "column": 19, + "column": 15, "line": 5, }, }, "range": Array [ - 108, - 109, + 114, + 115, ], "type": "Punctuator", - "value": "(", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 17, "line": 5, }, "start": Object { - "column": 20, + "column": 16, "line": 5, }, }, "range": Array [ - 109, - 110, + 115, + 116, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 116, + 117, ], "type": "Punctuator", - "value": ")", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 19, "line": 5, }, "start": Object { - "column": 21, + "column": 18, "line": 5, }, }, "range": Array [ - 110, - 111, + 117, + 118, ], "type": "Punctuator", "value": ";", @@ -72060,7 +82244,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 6, }, "start": Object { @@ -72069,11 +82253,11 @@ Object { }, }, "range": Array [ - 114, - 117, + 121, + 122, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -72082,21 +82266,21 @@ Object { "line": 6, }, "start": Object { - "column": 5, + "column": 3, "line": 6, }, }, "range": Array [ - 117, - 118, + 122, + 125, ], - "type": "Punctuator", - "value": ".", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 6, }, "start": Object { @@ -72105,56 +82289,56 @@ Object { }, }, "range": Array [ - 118, - 121, + 125, + 126, ], - "type": "Identifier", - "value": "two", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 8, "line": 6, }, "start": Object { - "column": 9, + "column": 7, "line": 6, }, }, "range": Array [ - 121, - 123, + 126, + 127, ], - "type": "Punctuator", - "value": "?.", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 9, "line": 6, }, "start": Object { - "column": 11, + "column": 8, "line": 6, }, }, "range": Array [ - 123, + 127, 128, ], - "type": "Identifier", - "value": "three", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 11, "line": 6, }, "start": Object { - "column": 16, + "column": 9, "line": 6, }, }, @@ -72168,29 +82352,47 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 12, "line": 6, }, "start": Object { - "column": 18, + "column": 11, "line": 6, }, }, "range": Array [ 130, + 131, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 131, 132, ], - "type": "Identifier", - "value": "fn", + "type": "Numeric", + "value": "3", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 14, "line": 6, }, "start": Object { - "column": 20, + "column": 13, "line": 6, }, }, @@ -72199,148 +82401,148 @@ Object { 133, ], "type": "Punctuator", - "value": "(", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 16, "line": 6, }, "start": Object { - "column": 21, + "column": 14, "line": 6, }, }, "range": Array [ 133, - 134, + 135, ], "type": "Punctuator", - "value": ")", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 17, "line": 6, }, "start": Object { - "column": 22, + "column": 16, "line": 6, }, }, "range": Array [ - 134, 135, + 136, ], "type": "Punctuator", - "value": ";", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 8, + "column": 18, + "line": 6, }, "start": Object { - "column": 2, - "line": 8, + "column": 17, + "line": 6, }, }, "range": Array [ - 139, - 142, + 136, + 137, ], - "type": "Identifier", - "value": "one", + "type": "Numeric", + "value": "4", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 8, + "column": 19, + "line": 6, }, "start": Object { - "column": 5, - "line": 8, + "column": 18, + "line": 6, }, }, "range": Array [ - 142, - 144, + 137, + 138, ], "type": "Punctuator", - "value": "?.", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 8, + "column": 20, + "line": 6, }, "start": Object { - "column": 7, - "line": 8, + "column": 19, + "line": 6, }, }, "range": Array [ - 144, - 145, + 138, + 139, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 8, + "column": 21, + "line": 6, }, "start": Object { - "column": 8, - "line": 8, + "column": 20, + "line": 6, }, }, "range": Array [ - 145, - 146, + 139, + 140, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 8, + "column": 3, + "line": 7, }, "start": Object { - "column": 9, - "line": 8, + "column": 2, + "line": 7, }, }, "range": Array [ - 146, - 147, + 143, + 144, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 9, + "column": 6, + "line": 7, }, "start": Object { - "column": 2, - "line": 9, + "column": 3, + "line": 7, }, }, "range": Array [ - 150, - 153, + 144, + 147, ], "type": "Identifier", "value": "one", @@ -72349,70 +82551,70 @@ Object { "loc": Object { "end": Object { "column": 7, - "line": 9, + "line": 7, }, "start": Object { - "column": 5, - "line": 9, + "column": 6, + "line": 7, }, }, "range": Array [ - 153, - 155, + 147, + 148, ], "type": "Punctuator", - "value": "?.", + "value": "[", }, Object { "loc": Object { "end": Object { "column": 8, - "line": 9, + "line": 7, }, "start": Object { "column": 7, - "line": 9, + "line": 7, }, }, "range": Array [ - 155, - 156, + 148, + 149, ], - "type": "Punctuator", - "value": "(", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 9, + "line": 7, }, "start": Object { "column": 8, - "line": 9, + "line": 7, }, }, "range": Array [ - 156, - 157, + 149, + 150, ], "type": "Punctuator", - "value": ")", + "value": "]", }, Object { "loc": Object { "end": Object { "column": 11, - "line": 9, + "line": 7, }, "start": Object { "column": 9, - "line": 9, + "line": 7, }, }, "range": Array [ - 157, - 159, + 150, + 152, ], "type": "Punctuator", "value": "?.", @@ -72421,124 +82623,142 @@ Object { "loc": Object { "end": Object { "column": 12, - "line": 9, + "line": 7, }, "start": Object { "column": 11, - "line": 9, + "line": 7, }, }, "range": Array [ - 159, - 160, + 152, + 153, ], "type": "Punctuator", - "value": "(", + "value": "[", }, Object { "loc": Object { "end": Object { "column": 13, - "line": 9, + "line": 7, }, "start": Object { "column": 12, - "line": 9, + "line": 7, }, }, "range": Array [ - 160, - 161, + 153, + 154, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "3", }, Object { "loc": Object { "end": Object { "column": 14, - "line": 9, + "line": 7, }, "start": Object { "column": 13, - "line": 9, + "line": 7, }, }, "range": Array [ - 161, - 162, + 154, + 155, ], "type": "Punctuator", - "value": ";", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 11, + "column": 16, + "line": 7, }, "start": Object { - "column": 2, - "line": 11, + "column": 14, + "line": 7, }, }, "range": Array [ - 166, - 169, + 155, + 157, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 11, + "column": 17, + "line": 7, }, "start": Object { - "column": 5, - "line": 11, + "column": 16, + "line": 7, }, }, "range": Array [ - 169, - 171, + 157, + 158, ], "type": "Punctuator", - "value": "?.", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 11, + "column": 18, + "line": 7, }, "start": Object { - "column": 7, - "line": 11, + "column": 17, + "line": 7, }, }, "range": Array [ - 171, - 172, + 158, + 159, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 159, + 160, ], "type": "Punctuator", - "value": "(", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 11, + "column": 20, + "line": 7, }, "start": Object { - "column": 8, - "line": 11, + "column": 19, + "line": 7, }, }, "range": Array [ - 172, - 173, + 160, + 161, ], "type": "Punctuator", "value": ")", @@ -72546,53 +82766,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 11, + "column": 21, + "line": 7, }, "start": Object { - "column": 9, - "line": 11, + "column": 20, + "line": 7, }, }, "range": Array [ - 173, - 174, + 161, + 162, ], "type": "Punctuator", - "value": ".", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 11, + "column": 22, + "line": 7, }, "start": Object { - "column": 10, - "line": 11, + "column": 21, + "line": 7, }, }, "range": Array [ - 174, - 177, + 162, + 163, ], - "type": "Identifier", - "value": "two", + "type": "Numeric", + "value": "5", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 11, + "column": 23, + "line": 7, }, "start": Object { - "column": 13, - "line": 11, + "column": 22, + "line": 7, }, }, "range": Array [ - 177, - 178, + 163, + 164, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 7, + }, + "start": Object { + "column": 23, + "line": 7, + }, + }, + "range": Array [ + 164, + 165, ], "type": "Punctuator", "value": ";", @@ -72601,16 +82839,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 12, + "line": 8, }, "start": Object { "column": 0, - "line": 12, + "line": 8, }, }, "range": Array [ - 179, - 180, + 166, + 167, ], "type": "Punctuator", "value": "}", @@ -72620,7 +82858,7 @@ Object { } `; -exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-with-parens.src 1`] = ` Object { "body": Array [ Object { @@ -72629,25 +82867,25 @@ Object { "body": Array [ Object { "expression": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 2, }, "start": Object { - "column": 2, + "column": 3, "line": 2, }, }, "object": Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 2, }, "start": Object { - "column": 2, + "column": 3, "line": 2, }, }, @@ -72662,7 +82900,7 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 2, }, "start": Object { @@ -72670,13 +82908,12 @@ Object { "line": 2, }, }, + "name": "two", "range": Array [ - 53, - 54, + 52, + 55, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ 47, @@ -72686,7 +82923,7 @@ Object { }, "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 2, }, "start": Object { @@ -72695,17 +82932,17 @@ Object { }, }, "range": Array [ - 47, - 56, + 46, + 57, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 13, + "column": 18, "line": 3, }, "start": Object { @@ -72714,32 +82951,32 @@ Object { }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 3, }, "start": Object { - "column": 2, + "column": 3, "line": 3, }, }, "object": Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 3, }, "start": Object { - "column": 2, + "column": 3, "line": 3, }, }, "name": "one", "range": Array [ - 59, - 62, + 61, + 64, ], "type": "Identifier", }, @@ -72747,7 +82984,7 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 3, }, "start": Object { @@ -72755,17 +82992,16 @@ Object { "line": 3, }, }, + "name": "two", "range": Array [ - 65, 66, + 69, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ - 59, - 67, + 61, + 69, ], "type": "OptionalMemberExpression", }, @@ -72773,31 +83009,30 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 12, + "column": 18, "line": 3, }, "start": Object { - "column": 11, + "column": 13, "line": 3, }, }, + "name": "three", "range": Array [ - 68, - 69, + 71, + 76, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", }, "range": Array [ - 59, - 70, + 60, + 76, ], - "type": "OptionalMemberExpression", + "type": "MemberExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 3, }, "start": Object { @@ -72806,51 +83041,51 @@ Object { }, }, "range": Array [ - 59, - 71, + 60, + 77, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 13, + "column": 17, "line": 4, }, "start": Object { - "column": 2, + "column": 3, "line": 4, }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 4, }, "start": Object { - "column": 2, + "column": 3, "line": 4, }, }, "object": Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 4, }, "start": Object { - "column": 2, + "column": 3, "line": 4, }, }, "name": "one", "range": Array [ - 74, - 77, + 81, + 84, ], "type": "Identifier", }, @@ -72858,25 +83093,24 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 4, }, "start": Object { - "column": 6, + "column": 7, "line": 4, }, }, + "name": "two", "range": Array [ - 78, - 79, + 85, + 88, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ - 74, - 80, + 81, + 88, ], "type": "MemberExpression", }, @@ -72884,31 +83118,30 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 4, }, "start": Object { - "column": 11, + "column": 12, "line": 4, }, }, + "name": "three", "range": Array [ - 83, - 84, + 90, + 95, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", }, "range": Array [ - 74, - 85, + 81, + 95, ], "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 4, }, "start": Object { @@ -72917,17 +83150,17 @@ Object { }, }, "range": Array [ - 74, - 86, + 80, + 97, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 13, + "column": 23, "line": 5, }, "start": Object { @@ -72936,90 +83169,125 @@ Object { }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 8, + "column": 17, "line": 5, }, "start": Object { - "column": 2, + "column": 3, "line": 5, }, }, "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 5, }, "start": Object { - "column": 2, + "column": 3, "line": 5, }, }, - "name": "one", + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "one", + "range": Array [ + 101, + 104, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "name": "two", + "range": Array [ + 105, + 108, + ], + "type": "Identifier", + }, "range": Array [ - 89, - 92, + 101, + 108, ], - "type": "Identifier", + "type": "MemberExpression", }, - "optional": false, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 7, + "column": 17, "line": 5, }, "start": Object { - "column": 6, + "column": 12, "line": 5, }, }, + "name": "three", "range": Array [ - 93, - 94, + 110, + 115, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ - 89, - 95, + 101, + 115, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, - "optional": true, + "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 5, }, "start": Object { - "column": 11, + "column": 19, "line": 5, }, }, + "name": "four", "range": Array [ - 98, - 99, + 117, + 121, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", }, "range": Array [ - 89, 100, + 121, ], - "type": "OptionalMemberExpression", + "type": "MemberExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 24, "line": 5, }, "start": Object { @@ -73028,63 +83296,63 @@ Object { }, }, "range": Array [ - 89, - 101, + 100, + 122, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 16, + "column": 23, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 13, + "column": 17, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, "object": Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, "name": "one", "range": Array [ - 104, - 107, + 126, + 129, ], "type": "Identifier", }, @@ -73092,25 +83360,24 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 6, }, "start": Object { - "column": 6, + "column": 7, "line": 6, }, }, + "name": "two", "range": Array [ - 108, - 109, + 130, + 133, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ - 104, - 110, + 126, + 133, ], "type": "MemberExpression", }, @@ -73118,57 +83385,55 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 6, }, "start": Object { - "column": 11, + "column": 12, "line": 6, }, }, + "name": "three", "range": Array [ - 113, - 114, + 135, + 140, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", }, "range": Array [ - 104, - 115, + 126, + 140, ], "type": "OptionalMemberExpression", }, - "optional": false, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 6, }, "start": Object { - "column": 14, + "column": 19, "line": 6, }, }, + "name": "four", "range": Array [ - 116, - 117, + 142, + 146, ], - "raw": "4", - "type": "Literal", - "value": 4, + "type": "Identifier", }, "range": Array [ - 104, - 118, + 126, + 146, ], "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 6, }, "start": Object { @@ -73177,17 +83442,17 @@ Object { }, }, "range": Array [ - 104, - 119, + 125, + 148, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 18, + "column": 29, "line": 7, }, "start": Object { @@ -73196,128 +83461,162 @@ Object { }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 13, + "column": 23, "line": 7, }, "start": Object { - "column": 2, + "column": 3, "line": 7, }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 8, + "column": 17, "line": 7, }, "start": Object { - "column": 2, + "column": 3, "line": 7, }, }, "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 7, }, "start": Object { - "column": 2, + "column": 3, "line": 7, }, }, - "name": "one", + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "name": "one", + "range": Array [ + 152, + 155, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "name": "two", + "range": Array [ + 156, + 159, + ], + "type": "Identifier", + }, "range": Array [ - 122, - 125, + 152, + 159, ], - "type": "Identifier", + "type": "MemberExpression", }, - "optional": false, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 7, + "column": 17, "line": 7, }, "start": Object { - "column": 6, + "column": 12, "line": 7, }, }, + "name": "three", "range": Array [ - 126, - 127, + 161, + 166, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ - 122, - 128, + 152, + 166, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 7, }, "start": Object { - "column": 11, + "column": 19, "line": 7, }, }, + "name": "four", "range": Array [ - 131, - 132, + 168, + 172, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", }, "range": Array [ - 122, - 133, + 152, + 172, ], "type": "OptionalMemberExpression", }, - "optional": true, + "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 17, + "column": 29, "line": 7, }, "start": Object { - "column": 16, + "column": 25, "line": 7, }, }, + "name": "five", "range": Array [ - 136, - 137, + 174, + 178, ], - "raw": "4", - "type": "Literal", - "value": 4, + "type": "Identifier", }, "range": Array [ - 122, - 138, + 151, + 178, ], - "type": "OptionalMemberExpression", + "type": "MemberExpression", }, "loc": Object { "end": Object { - "column": 19, + "column": 30, "line": 7, }, "start": Object { @@ -73326,8 +83625,8 @@ Object { }, }, "range": Array [ - 122, - 139, + 151, + 179, ], "type": "ExpressionStatement", }, @@ -73338,13 +83637,13 @@ Object { "line": 8, }, "start": Object { - "column": 43, + "column": 42, "line": 1, }, }, "range": Array [ - 43, - 141, + 42, + 181, ], "type": "BlockStatement", }, @@ -73353,7 +83652,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 31, + "column": 30, "line": 1, }, "start": Object { @@ -73361,10 +83660,10 @@ Object { "line": 1, }, }, - "name": "processOptionalElement", + "name": "processOptionalParens", "range": Array [ 9, - 31, + 30, ], "type": "Identifier", }, @@ -73382,51 +83681,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 40, "line": 1, }, "start": Object { - "column": 32, + "column": 31, "line": 1, }, }, "name": "one", "optional": true, "range": Array [ - 32, - 41, + 31, + 40, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 40, "line": 1, }, "start": Object { - "column": 36, + "column": 35, "line": 1, }, }, "range": Array [ - 36, - 41, + 35, + 40, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 40, "line": 1, }, "start": Object { - "column": 38, + "column": 37, "line": 1, }, }, "range": Array [ - 38, - 41, + 37, + 40, ], "type": "TSAnyKeyword", }, @@ -73435,7 +83734,7 @@ Object { ], "range": Array [ 0, - 141, + 181, ], "type": "FunctionDeclaration", }, @@ -73452,7 +83751,7 @@ Object { }, "range": Array [ 0, - 142, + 182, ], "sourceType": "script", "tokens": Array [ @@ -73477,7 +83776,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 30, "line": 1, }, "start": Object { @@ -73487,25 +83786,25 @@ Object { }, "range": Array [ 9, - 31, + 30, ], "type": "Identifier", - "value": "processOptionalElement", + "value": "processOptionalParens", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 31, "line": 1, }, "start": Object { - "column": 31, + "column": 30, "line": 1, }, }, "range": Array [ + 30, 31, - 32, ], "type": "Punctuator", "value": "(", @@ -73513,17 +83812,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 34, "line": 1, }, "start": Object { - "column": 32, + "column": 31, "line": 1, }, }, "range": Array [ - 32, - 35, + 31, + 34, ], "type": "Identifier", "value": "one", @@ -73531,17 +83830,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, + "column": 35, "line": 1, }, "start": Object { - "column": 35, + "column": 34, "line": 1, }, }, "range": Array [ + 34, 35, - 36, ], "type": "Punctuator", "value": "?", @@ -73549,17 +83848,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, + "column": 36, "line": 1, }, "start": Object { - "column": 36, + "column": 35, "line": 1, }, }, "range": Array [ + 35, 36, - 37, ], "type": "Punctuator", "value": ":", @@ -73567,17 +83866,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 40, "line": 1, }, "start": Object { - "column": 38, + "column": 37, "line": 1, }, }, "range": Array [ - 38, - 41, + 37, + 40, ], "type": "Identifier", "value": "any", @@ -73585,17 +83884,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 41, "line": 1, }, "start": Object { - "column": 41, + "column": 40, "line": 1, }, }, "range": Array [ + 40, 41, - 42, ], "type": "Punctuator", "value": ")", @@ -73603,17 +83902,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 44, + "column": 43, "line": 1, }, "start": Object { - "column": 43, + "column": 42, "line": 1, }, }, "range": Array [ + 42, 43, - 44, ], "type": "Punctuator", "value": "{", @@ -73621,7 +83920,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 2, }, "start": Object { @@ -73630,29 +83929,29 @@ Object { }, }, "range": Array [ + 46, 47, - 50, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 6, "line": 2, }, "start": Object { - "column": 5, + "column": 3, "line": 2, }, }, "range": Array [ + 47, 50, - 52, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { @@ -73661,21 +83960,21 @@ Object { "line": 2, }, "start": Object { - "column": 7, + "column": 6, "line": 2, }, }, "range": Array [ + 50, 52, - 53, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 2, }, "start": Object { @@ -73684,44 +83983,44 @@ Object { }, }, "range": Array [ - 53, - 54, + 52, + 55, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 2, }, "start": Object { - "column": 9, + "column": 11, "line": 2, }, }, "range": Array [ - 54, 55, + 56, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 2, }, "start": Object { - "column": 10, + "column": 12, "line": 2, }, }, "range": Array [ - 55, 56, + 57, ], "type": "Punctuator", "value": ";", @@ -73729,7 +84028,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 3, }, "start": Object { @@ -73738,83 +84037,47 @@ Object { }, }, "range": Array [ - 59, - 62, - ], - "type": "Identifier", - "value": "one", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 62, - 64, + 60, + 61, ], "type": "Punctuator", - "value": "?.", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 3, }, "start": Object { - "column": 7, + "column": 3, "line": 3, }, }, "range": Array [ + 61, 64, - 65, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { "column": 8, "line": 3, }, - }, - "range": Array [ - 65, - 66, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, "start": Object { - "column": 9, + "column": 6, "line": 3, }, }, "range": Array [ + 64, 66, - 67, ], "type": "Punctuator", - "value": "]", + "value": "?.", }, Object { "loc": Object { @@ -73823,16 +84086,16 @@ Object { "line": 3, }, "start": Object { - "column": 10, + "column": 8, "line": 3, }, }, "range": Array [ - 67, - 68, + 66, + 69, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { @@ -73846,11 +84109,11 @@ Object { }, }, "range": Array [ - 68, 69, + 70, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -73864,16 +84127,16 @@ Object { }, }, "range": Array [ - 69, 70, + 71, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 18, "line": 3, }, "start": Object { @@ -73882,83 +84145,83 @@ Object { }, }, "range": Array [ - 70, 71, + 76, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 19, + "line": 3, }, "start": Object { - "column": 2, - "line": 4, + "column": 18, + "line": 3, }, }, "range": Array [ - 74, + 76, 77, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 3, "line": 4, }, "start": Object { - "column": 5, + "column": 2, "line": 4, }, }, "range": Array [ - 77, - 78, + 80, + 81, ], "type": "Punctuator", - "value": "[", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 6, "line": 4, }, "start": Object { - "column": 6, + "column": 3, "line": 4, }, }, "range": Array [ - 78, - 79, + 81, + 84, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 7, "line": 4, }, "start": Object { - "column": 7, + "column": 6, "line": 4, }, }, "range": Array [ - 79, - 80, + 84, + 85, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { @@ -73967,21 +84230,21 @@ Object { "line": 4, }, "start": Object { - "column": 8, + "column": 7, "line": 4, }, }, "range": Array [ - 80, - 82, + 85, + 88, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 4, }, "start": Object { @@ -73990,62 +84253,62 @@ Object { }, }, "range": Array [ - 82, - 83, + 88, + 90, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 4, }, "start": Object { - "column": 11, + "column": 12, "line": 4, }, }, "range": Array [ - 83, - 84, + 90, + 95, ], - "type": "Numeric", - "value": "3", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 18, "line": 4, }, "start": Object { - "column": 12, + "column": 17, "line": 4, }, }, "range": Array [ - 84, - 85, + 95, + 96, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 4, }, "start": Object { - "column": 13, + "column": 18, "line": 4, }, }, "range": Array [ - 85, - 86, + 96, + 97, ], "type": "Punctuator", "value": ";", @@ -74053,7 +84316,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 5, }, "start": Object { @@ -74062,11 +84325,11 @@ Object { }, }, "range": Array [ - 89, - 92, + 100, + 101, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -74075,16 +84338,16 @@ Object { "line": 5, }, "start": Object { - "column": 5, + "column": 3, "line": 5, }, }, "range": Array [ - 92, - 93, + 101, + 104, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { @@ -74098,16 +84361,16 @@ Object { }, }, "range": Array [ - 93, - 94, + 104, + 105, ], - "type": "Numeric", - "value": "2", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 5, }, "start": Object { @@ -74116,26 +84379,26 @@ Object { }, }, "range": Array [ - 94, - 95, + 105, + 108, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 5, }, "start": Object { - "column": 8, + "column": 10, "line": 5, }, }, "range": Array [ - 95, - 97, + 108, + 110, ], "type": "Punctuator", "value": "?.", @@ -74143,146 +84406,146 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 17, "line": 5, }, "start": Object { - "column": 10, + "column": 12, "line": 5, }, }, "range": Array [ - 97, - 98, + 110, + 115, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 18, "line": 5, }, "start": Object { - "column": 11, + "column": 17, "line": 5, }, }, "range": Array [ - 98, - 99, + 115, + 116, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 19, "line": 5, }, "start": Object { - "column": 12, + "column": 18, "line": 5, }, }, "range": Array [ - 99, - 100, + 116, + 117, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 23, "line": 5, }, "start": Object { - "column": 13, + "column": 19, "line": 5, }, }, "range": Array [ - 100, - 101, + 117, + 121, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "four", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 24, + "line": 5, }, "start": Object { - "column": 2, - "line": 6, + "column": 23, + "line": 5, }, }, "range": Array [ - 104, - 107, + 121, + 122, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 3, "line": 6, }, "start": Object { - "column": 5, + "column": 2, "line": 6, }, }, "range": Array [ - 107, - 108, + 125, + 126, ], "type": "Punctuator", - "value": "[", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 6, "line": 6, }, "start": Object { - "column": 6, + "column": 3, "line": 6, }, }, "range": Array [ - 108, - 109, + 126, + 129, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 7, "line": 6, }, "start": Object { - "column": 7, + "column": 6, "line": 6, }, }, "range": Array [ - 109, - 110, + 129, + 130, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { @@ -74291,21 +84554,21 @@ Object { "line": 6, }, "start": Object { - "column": 8, + "column": 7, "line": 6, }, }, "range": Array [ - 110, - 112, + 130, + 133, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 6, }, "start": Object { @@ -74314,34 +84577,16 @@ Object { }, }, "range": Array [ - 112, - 113, + 133, + 135, ], "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 11, - "line": 6, - }, - }, - "range": Array [ - 113, - 114, - ], - "type": "Numeric", - "value": "3", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 17, "line": 6, }, "start": Object { @@ -74350,80 +84595,80 @@ Object { }, }, "range": Array [ - 114, - 115, + 135, + 140, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 6, }, "start": Object { - "column": 13, + "column": 17, "line": 6, }, }, "range": Array [ - 115, - 116, + 140, + 142, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 6, }, "start": Object { - "column": 14, + "column": 19, "line": 6, }, }, "range": Array [ - 116, - 117, + 142, + 146, ], - "type": "Numeric", - "value": "4", + "type": "Identifier", + "value": "four", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 6, }, "start": Object { - "column": 15, + "column": 23, "line": 6, }, }, "range": Array [ - 117, - 118, + 146, + 147, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 6, }, "start": Object { - "column": 16, + "column": 24, "line": 6, }, }, "range": Array [ - 118, - 119, + 147, + 148, ], "type": "Punctuator", "value": ";", @@ -74431,7 +84676,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 7, }, "start": Object { @@ -74440,11 +84685,11 @@ Object { }, }, "range": Array [ - 122, - 125, + 151, + 152, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -74453,16 +84698,16 @@ Object { "line": 7, }, "start": Object { - "column": 5, + "column": 3, "line": 7, }, }, "range": Array [ - 125, - 126, + 152, + 155, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { @@ -74476,29 +84721,11 @@ Object { }, }, "range": Array [ - 126, - 127, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 7, - }, - "start": Object { - "column": 7, - "line": 7, - }, - }, - "range": Array [ - 127, - 128, + 155, + 156, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { @@ -74507,21 +84734,21 @@ Object { "line": 7, }, "start": Object { - "column": 8, + "column": 7, "line": 7, }, }, "range": Array [ - 128, - 130, + 156, + 159, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 7, }, "start": Object { @@ -74530,134 +84757,134 @@ Object { }, }, "range": Array [ - 130, - 131, + 159, + 161, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 7, }, "start": Object { - "column": 11, + "column": 12, "line": 7, }, }, "range": Array [ - 131, - 132, + 161, + 166, ], - "type": "Numeric", - "value": "3", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 19, "line": 7, }, "start": Object { - "column": 12, + "column": 17, "line": 7, }, }, "range": Array [ - 132, - 133, + 166, + 168, ], "type": "Punctuator", - "value": "]", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 7, }, "start": Object { - "column": 13, + "column": 19, "line": 7, }, }, "range": Array [ - 133, - 135, + 168, + 172, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "four", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 7, }, "start": Object { - "column": 15, + "column": 23, "line": 7, }, }, "range": Array [ - 135, - 136, + 172, + 173, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 7, }, "start": Object { - "column": 16, + "column": 24, "line": 7, }, }, "range": Array [ - 136, - 137, + 173, + 174, ], - "type": "Numeric", - "value": "4", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 29, "line": 7, }, "start": Object { - "column": 17, + "column": 25, "line": 7, }, }, "range": Array [ - 137, - 138, + 174, + 178, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "five", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 30, "line": 7, }, "start": Object { - "column": 18, + "column": 29, "line": 7, }, }, "range": Array [ - 138, - 139, + 178, + 179, ], "type": "Punctuator", "value": ";", @@ -74674,8 +84901,8 @@ Object { }, }, "range": Array [ - 140, - 141, + 180, + 181, ], "type": "Punctuator", "value": "}", @@ -80914,6 +91141,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -83434,6 +93662,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -86347,6 +96576,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -89936,6 +100166,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -108673,6 +118904,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -108767,6 +118999,7 @@ Object { }, Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -109354,6 +119587,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -109468,6 +119702,7 @@ Object { }, Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -110022,6 +120257,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -110097,6 +120333,7 @@ Object { }, Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -110468,6 +120705,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -110543,6 +120781,7 @@ Object { }, Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -145963,6 +156202,7 @@ Object { Object { "accessibility": "public", "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/lib/persistentParse.ts b/packages/typescript-estree/tests/lib/persistentParse.ts index bb77cefd7f7f..e1cb8b9f9b76 100644 --- a/packages/typescript-estree/tests/lib/persistentParse.ts +++ b/packages/typescript-estree/tests/lib/persistentParse.ts @@ -40,12 +40,16 @@ function renameFile(dirName: string, src: 'bar', dest: 'baz/bar'): void { ); } -function setup(tsconfig: Record, writeBar = true): string { +function createTmpDir(): tmp.DirResult { const tmpDir = tmp.dirSync({ keep: false, unsafeCleanup: true, }); tmpDirs.add(tmpDir); + return tmpDir; +} +function setup(tsconfig: Record, writeBar = true): string { + const tmpDir = createTmpDir(); writeTSConfig(tmpDir.name, tsconfig); @@ -141,4 +145,34 @@ describe('persistent lint session', () => { expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); expect(() => parseFile('bar', PROJECT_DIR)).not.toThrow(); }); + + it('handles tsconfigs with no includes/excludes (single level)', () => { + const PROJECT_DIR = setup({}, false); + + // parse once to: assert the config as correct, and to make sure the program is setup + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('bar', PROJECT_DIR)).toThrow(); + + // write a new file and attempt to parse it + writeFile(PROJECT_DIR, 'bar'); + + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('bar', PROJECT_DIR)).not.toThrow(); + }); + + it('handles tsconfigs with no includes/excludes (nested)', () => { + const PROJECT_DIR = setup({}, false); + + // parse once to: assert the config as correct, and to make sure the program is setup + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('baz/bar', PROJECT_DIR)).toThrow(); + + // write a new file and attempt to parse it + writeFile(PROJECT_DIR, 'baz/bar'); + + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('baz/bar', PROJECT_DIR)).not.toThrow(); + }); + + // TODO - support the complex monorepo case with a tsconfig with no include/exclude }); diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index ccbc9d905819..05e65137db43 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -254,7 +254,10 @@ describe('semanticInfo', () => { badConfig.project = '.'; expect(() => parseCodeAndGenerateServices(readFileSync(fileName, 'utf8'), badConfig), - ).toThrow(/File .+semanticInfo' not found/); + ).toThrow( + // case insensitive because unix based systems are case insensitive + /File .+semanticInfo' not found/i, + ); }); it('malformed project file', () => { diff --git a/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts b/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts index 9e6a26a39a66..581d28a7e961 100644 --- a/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts +++ b/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts @@ -3,15 +3,20 @@ import * as parser from '../../src/parser'; jest.mock('semver'); +const resetIsTTY = process.stdout.isTTY; + describe('Warn on unsupported TypeScript version', () => { afterEach(() => { jest.resetModules(); jest.resetAllMocks(); + process.stdout.isTTY = resetIsTTY; }); it('should warn the user if they are using an unsupported TypeScript version', () => { (semver.satisfies as jest.Mock).mockReturnValue(false); jest.spyOn(console, 'log').mockImplementation(); + process.stdout.isTTY = true; + parser.parse(''); expect(console.log).toHaveBeenCalledWith( expect.stringContaining( @@ -19,4 +24,13 @@ describe('Warn on unsupported TypeScript version', () => { ), ); }); + + it('should not warn the user when the user is running on a non TTY process', () => { + (semver.satisfies as jest.Mock).mockReturnValue(false); + jest.spyOn(console, 'log').mockImplementation(); + process.stdout.isTTY = false; + + parser.parse(''); + expect(console.log).not.toHaveBeenCalled(); + }); });