From 06bec63c56536db070608ab136d2ad57083f0c6a Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Thu, 21 May 2020 09:26:37 -0700 Subject: [PATCH] feat(typescript-estree): handle 3.9's non-null assertion changes (#2036) --- package.json | 2 +- packages/eslint-plugin/package.json | 1 + .../no-non-null-asserted-optional-chain.ts | 31 +- ...o-non-null-asserted-optional-chain.test.ts | 32 +- .../tests/rules/no-unsafe-call.test.ts | 13 +- .../tests/rules/no-unsafe-return.test.ts | 24 +- .../restrict-template-expressions.test.ts | 25 +- .../lib/__snapshots__/typescript.ts.snap | 1263 +- ...-chain-call-with-non-null-assertion.src.ts | 8 + ...ment-access-with-non-null-assertion.src.ts | 8 + ...ional-chain-with-non-null-assertion.src.ts | 5 + packages/typescript-estree/src/convert.ts | 25 +- packages/typescript-estree/src/node-utils.ts | 65 + .../src/ts-estree/ts-nodes.ts | 371 +- .../tests/lib/__snapshots__/convert.ts.snap | 1 + .../semantic-diagnostics-enabled.ts.snap | 6 + .../lib/__snapshots__/typescript.ts.snap | 11754 +++++++++++----- .../tests/lib/semanticInfo.ts | 4 +- yarn.lock | 8 +- 19 files changed, 9987 insertions(+), 3659 deletions(-) create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call-with-non-null-assertion.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access-with-non-null-assertion.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/optional-chain-with-non-null-assertion.src.ts diff --git a/package.json b/package.json index c317a871da2..14c09a7d3f6 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "ts-jest": "^25.5.1", "ts-node": "^8.10.1", "tslint": "^6.1.2", - "typescript": ">=3.2.1 <3.9.0" + "typescript": ">=3.2.1 <4.0.0" }, "resolutions": { "typescript": "^3.8.3" diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index a08286a3c63..ea80890eef0 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -44,6 +44,7 @@ "@typescript-eslint/experimental-utils": "2.34.0", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", + "semver": "^7.3.2", "tsutils": "^3.17.1" }, "devDependencies": { diff --git a/packages/eslint-plugin/src/rules/no-non-null-asserted-optional-chain.ts b/packages/eslint-plugin/src/rules/no-non-null-asserted-optional-chain.ts index b3704b8d5dd..9ebc2d6a61f 100644 --- a/packages/eslint-plugin/src/rules/no-non-null-asserted-optional-chain.ts +++ b/packages/eslint-plugin/src/rules/no-non-null-asserted-optional-chain.ts @@ -1,8 +1,19 @@ -import { TSESTree, TSESLint } from '@typescript-eslint/experimental-utils'; +import { + TSESTree, + TSESLint, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; +import { version } from 'typescript'; +import * as semver from 'semver'; import * as util from '../util'; type MessageIds = 'noNonNullOptionalChain' | 'suggestRemovingNonNull'; +const is3dot9 = !semver.satisfies( + version, + '< 3.9.0 || < 3.9.1-rc || < 3.9.0-beta', +); + export default util.createRule<[], MessageIds>({ name: 'no-non-null-asserted-optional-chain', meta: { @@ -29,6 +40,24 @@ export default util.createRule<[], MessageIds>({ | TSESTree.OptionalCallExpression | TSESTree.OptionalMemberExpression, ): void { + if (is3dot9) { + // TS3.9 made a breaking change to how non-null works with optional chains. + // Pre-3.9, `x?.y!.z` means `(x?.y).z` - i.e. it essentially scrubbed the optionality from the chain + // Post-3.9, `x?.y!.z` means `x?.y!.z` - i.e. it just asserts that the property `y` is non-null, not the result of `x?.y`. + // This means that for > 3.9, x?.y!.z is valid! + // NOTE: these cases are still invalid: + // - x?.y.z! + // - (x?.y)!.z + const nnAssertionParent = node.parent?.parent; + if ( + nnAssertionParent?.type === + AST_NODE_TYPES.OptionalMemberExpression || + nnAssertionParent?.type === AST_NODE_TYPES.OptionalCallExpression + ) { + return; + } + } + // selector guarantees this assertion const parent = node.parent as TSESTree.TSNonNullExpression; context.report({ diff --git a/packages/eslint-plugin/tests/rules/no-non-null-asserted-optional-chain.test.ts b/packages/eslint-plugin/tests/rules/no-non-null-asserted-optional-chain.test.ts index 0a28cbbfc92..6affcf2fef5 100644 --- a/packages/eslint-plugin/tests/rules/no-non-null-asserted-optional-chain.test.ts +++ b/packages/eslint-plugin/tests/rules/no-non-null-asserted-optional-chain.test.ts @@ -13,6 +13,10 @@ ruleTester.run('no-non-null-asserted-optional-chain', rule, { 'foo?.bar();', '(foo?.bar).baz!;', '(foo?.bar()).baz!;', + // Valid as of 3.9 + 'foo?.bar!.baz;', + 'foo?.bar!();', + "foo?.['bar']!.baz;", ], invalid: [ { @@ -71,20 +75,6 @@ ruleTester.run('no-non-null-asserted-optional-chain', rule, { }, ], }, - { - code: 'foo?.bar!();', - errors: [ - { - messageId: 'noNonNullOptionalChain', - suggestions: [ - { - messageId: 'suggestRemovingNonNull', - output: 'foo?.bar();', - }, - ], - }, - ], - }, { code: noFormat`(foo?.bar)!.baz`, errors: [ @@ -99,20 +89,6 @@ ruleTester.run('no-non-null-asserted-optional-chain', rule, { }, ], }, - { - code: "foo?.['bar']!.baz;", - errors: [ - { - messageId: 'noNonNullOptionalChain', - suggestions: [ - { - messageId: 'suggestRemovingNonNull', - output: "foo?.['bar'].baz;", - }, - ], - }, - ], - }, { code: noFormat`(foo?.bar)!().baz`, errors: [ diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts index f860410da5c..981abb0eadd 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts @@ -39,6 +39,12 @@ function foo(x: { a?: () => void }) { let foo: any = 23; String(foo); // ERROR: Unsafe call of an any typed value `, + // TS 3.9 changed this to be safe + ` + function foo(x: T) { + x(); + } + `, ], invalid: [ ...batchedSingleLineTests({ @@ -47,7 +53,6 @@ function foo(x: any) { x() } function foo(x: any) { x?.() } function foo(x: any) { x.a.b.c.d.e.f.g() } function foo(x: any) { x.a.b.c.d.e.f.g?.() } -function foo(x: T) { x() } `, errors: [ { @@ -74,12 +79,6 @@ function foo(x: T) { x() } column: 24, endColumn: 39, }, - { - messageId: 'unsafeCall', - line: 6, - column: 37, - endColumn: 38, - }, ], }), ...batchedSingleLineTests({ diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts index 42a58734a47..91627f91b02 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts @@ -71,26 +71,14 @@ function foo(): Set { return { prop: '' } as Foo; } `, + // TS 3.9 changed this to be safe + ` + function fn(x: T) { + return x; + } + `, ], invalid: [ - { - code: ` -function fn(x: T) { - return x; -} - `, - errors: [ - { - messageId: 'unsafeReturnAssignment', - data: { - sender: 'any', - receiver: 'T', - }, - line: 3, - column: 3, - }, - ], - }, ...batchedSingleLineTests({ code: noFormat` function foo() { return (1 as any); } diff --git a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts index 9b991053dcb..b0b3069062d 100644 --- a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts @@ -158,14 +158,6 @@ ruleTester.run('restrict-template-expressions', rule, { const msg = \`arg = \${user.name || 'the user with no name'}\`; `, }, - { - options: [{ allowAny: true }], - code: ` - function test(arg: T) { - return \`arg = \${arg}\`; - } - `, - }, // allowNullable { options: [{ allowNullable: true }], @@ -344,5 +336,22 @@ ruleTester.run('restrict-template-expressions', rule, { }, ], }, + // TS 3.9 change + { + options: [{ allowAny: true }], + code: ` + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + errors: [ + { + messageId: 'invalidType', + data: { type: 'unknown' }, + line: 3, + column: 27, + }, + ], + }, ], }); diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index 36c63d18c9a..97450c6c601 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -27847,33 +27847,33 @@ Object { } `; -exports[`typescript fixtures/basics/optional-chain-call-with-parens.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-call-with-non-null-assertion.src 1`] = ` Object { - "$id": 14, + "$id": 11, "block": Object { "range": Array [ 0, - 218, + 156, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 13, + "$id": 10, "block": Object { "range": Array [ 0, - 218, + 156, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 12, + "$id": 9, "block": Object { "range": Array [ 0, - 217, + 155, ], "type": "FunctionDeclaration", }, @@ -27884,13 +27884,13 @@ Object { Object { "$id": 3, "from": Object { - "$ref": 12, + "$ref": 9, }, "identifier": Object { "name": "one", "range": Array [ - 51, - 54, + 40, + 43, ], "type": "Identifier", }, @@ -27903,13 +27903,13 @@ Object { Object { "$id": 4, "from": Object { - "$ref": 12, + "$ref": 9, }, "identifier": Object { "name": "one", "range": Array [ - 66, - 69, + 55, + 58, ], "type": "Identifier", }, @@ -27922,13 +27922,13 @@ Object { Object { "$id": 5, "from": Object { - "$ref": 12, + "$ref": 9, }, "identifier": Object { "name": "one", "range": Array [ - 85, - 88, + 77, + 80, ], "type": "Identifier", }, @@ -27941,13 +27941,13 @@ Object { Object { "$id": 6, "from": Object { - "$ref": 12, + "$ref": 9, }, "identifier": Object { "name": "one", "range": Array [ - 104, - 107, + 94, + 97, ], "type": "Identifier", }, @@ -27960,13 +27960,13 @@ Object { Object { "$id": 7, "from": Object { - "$ref": 12, + "$ref": 9, }, "identifier": Object { "name": "one", "range": Array [ - 129, - 132, + 117, + 120, ], "type": "Identifier", }, @@ -27979,13 +27979,13 @@ Object { Object { "$id": 8, "from": Object { - "$ref": 12, + "$ref": 9, }, "identifier": Object { "name": "one", "range": Array [ - 156, - 159, + 134, + 137, ], "type": "Identifier", }, @@ -27995,16 +27995,964 @@ Object { }, "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": 9, + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "one", + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 155, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "one", + "range": Array [ + 25, + 34, + ], + "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 { + "processOptional": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "processOptional", + "range": Array [ + 9, + 24, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 155, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "processOptional", + "range": Array [ + 9, + 24, + ], + "type": "Identifier", + }, + ], + "name": "processOptional", + "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-call-with-parens.src 1`] = ` +Object { + "$id": 14, + "block": Object { + "range": Array [ + 0, + 218, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 13, + "block": Object { + "range": Array [ + 0, + 218, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 12, + "block": Object { + "range": Array [ + 0, + 217, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, "from": Object { "$ref": 12, }, "identifier": Object { "name": "one", "range": Array [ - 169, - 172, + 51, + 54, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 12, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 66, + 69, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 12, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 12, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 12, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 129, + 132, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 12, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 156, + 159, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 12, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 169, + 172, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 12, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 184, + 187, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 12, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 202, + 205, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 13, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "one": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 12, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 12, + }, + }, + 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": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 9, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 11, + }, + ], + "scope": Object { + "$ref": 12, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 14, + }, + "variableMap": Object { + "processOptionalCallParens": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 13, + }, + "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": 13, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 14, + }, + "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-non-null-assertion.src 1`] = ` +Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 183, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 183, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 182, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 64, + 67, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 113, + 116, ], "type": "Identifier", }, @@ -28015,15 +28963,15 @@ Object { "writeExpr": undefined, }, Object { - "$id": 10, + "$id": 7, "from": Object { - "$ref": 12, + "$ref": 9, }, "identifier": Object { "name": "one", "range": Array [ - 184, - 187, + 136, + 139, ], "type": "Identifier", }, @@ -28034,15 +28982,15 @@ Object { "writeExpr": undefined, }, Object { - "$id": 11, + "$id": 8, "from": Object { - "$ref": 12, + "$ref": 9, }, "identifier": Object { "name": "one", "range": Array [ - 202, - 205, + 160, + 163, ], "type": "Identifier", }, @@ -28056,7 +29004,7 @@ Object { "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 13, + "$ref": 10, }, "variableMap": Object { "arguments": Object { @@ -28067,7 +29015,7 @@ Object { }, }, "variableScope": Object { - "$ref": 12, + "$ref": 9, }, "variables": Array [ Object { @@ -28078,7 +29026,7 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 9, }, }, Object { @@ -28088,15 +29036,15 @@ Object { "name": Object { "name": "one", "range": Array [ - 35, - 44, + 25, + 34, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 217, + 182, ], "type": "FunctionDeclaration", }, @@ -28109,8 +29057,8 @@ Object { Object { "name": "one", "range": Array [ - 35, - 44, + 25, + 34, ], "type": "Identifier", }, @@ -28135,18 +29083,9 @@ Object { Object { "$ref": 8, }, - Object { - "$ref": 9, - }, - Object { - "$ref": 10, - }, - Object { - "$ref": 11, - }, ], "scope": Object { - "$ref": 12, + "$ref": 9, }, }, ], @@ -28158,15 +29097,15 @@ Object { "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 14, + "$ref": 11, }, "variableMap": Object { - "processOptionalCallParens": Object { + "processOptional": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 13, + "$ref": 10, }, "variables": Array [ Object { @@ -28174,17 +29113,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "processOptionalCallParens", + "name": "processOptional", "range": Array [ 9, - 34, + 24, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 217, + 182, ], "type": "FunctionDeclaration", }, @@ -28195,18 +29134,18 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "processOptionalCallParens", + "name": "processOptional", "range": Array [ 9, - 34, + 24, ], "type": "Identifier", }, ], - "name": "processOptionalCallParens", + "name": "processOptional", "references": Array [], "scope": Object { - "$ref": 13, + "$ref": 10, }, }, ], @@ -28220,19 +29159,19 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 14, + "$ref": 11, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-element-access-with-parens.src 1`] = ` Object { "$id": 11, "block": Object { "range": Array [ 0, - 142, + 168, ], "type": "Program", }, @@ -28242,7 +29181,7 @@ Object { "block": Object { "range": Array [ 0, - 142, + 168, ], "type": "Program", }, @@ -28252,7 +29191,7 @@ Object { "block": Object { "range": Array [ 0, - 141, + 167, ], "type": "FunctionDeclaration", }, @@ -28268,8 +29207,8 @@ Object { "identifier": Object { "name": "one", "range": Array [ - 47, - 50, + 54, + 57, ], "type": "Identifier", }, @@ -28287,8 +29226,8 @@ Object { "identifier": Object { "name": "one", "range": Array [ - 59, - 62, + 68, + 71, ], "type": "Identifier", }, @@ -28306,8 +29245,8 @@ Object { "identifier": Object { "name": "one", "range": Array [ - 74, - 77, + 85, + 88, ], "type": "Identifier", }, @@ -28325,8 +29264,8 @@ Object { "identifier": Object { "name": "one", "range": Array [ - 89, - 92, + 102, + 105, ], "type": "Identifier", }, @@ -28344,8 +29283,8 @@ Object { "identifier": Object { "name": "one", "range": Array [ - 104, - 107, + 122, + 125, ], "type": "Identifier", }, @@ -28363,8 +29302,8 @@ Object { "identifier": Object { "name": "one", "range": Array [ - 122, - 125, + 144, + 147, ], "type": "Identifier", }, @@ -28410,15 +29349,15 @@ Object { "name": Object { "name": "one", "range": Array [ - 32, - 41, + 38, + 47, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 141, + 167, ], "type": "FunctionDeclaration", }, @@ -28431,8 +29370,8 @@ Object { Object { "name": "one", "range": Array [ - 32, - 41, + 38, + 47, ], "type": "Identifier", }, @@ -28474,7 +29413,7 @@ Object { "$ref": 11, }, "variableMap": Object { - "processOptionalElement": Object { + "processOptionalElementParens": Object { "$ref": 0, }, }, @@ -28487,17 +29426,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "processOptionalElement", + "name": "processOptionalElementParens", "range": Array [ 9, - 31, + 37, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 141, + 167, ], "type": "FunctionDeclaration", }, @@ -28508,15 +29447,15 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "processOptionalElement", + "name": "processOptionalElementParens", "range": Array [ 9, - 31, + 37, ], "type": "Identifier", }, ], - "name": "processOptionalElement", + "name": "processOptionalElementParens", "references": Array [], "scope": Object { "$ref": 10, @@ -28539,33 +29478,33 @@ Object { } `; -exports[`typescript fixtures/basics/optional-chain-element-access-with-parens.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-with-non-null-assertion.src 1`] = ` Object { - "$id": 11, + "$id": 8, "block": Object { "range": Array [ 0, - 168, + 101, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 10, + "$id": 7, "block": Object { "range": Array [ 0, - 168, + 101, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 9, + "$id": 6, "block": Object { "range": Array [ 0, - 167, + 100, ], "type": "FunctionDeclaration", }, @@ -28576,13 +29515,13 @@ Object { Object { "$id": 3, "from": Object { - "$ref": 9, + "$ref": 6, }, "identifier": Object { "name": "one", "range": Array [ - 54, - 57, + 40, + 43, ], "type": "Identifier", }, @@ -28595,13 +29534,13 @@ Object { Object { "$id": 4, "from": Object { - "$ref": 9, + "$ref": 6, }, "identifier": Object { "name": "one", "range": Array [ - 68, - 71, + 60, + 63, ], "type": "Identifier", }, @@ -28614,70 +29553,13 @@ Object { 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, + "$ref": 6, }, "identifier": Object { "name": "one", "range": Array [ - 144, - 147, + 81, + 84, ], "type": "Identifier", }, @@ -28691,7 +29573,7 @@ Object { "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 10, + "$ref": 7, }, "variableMap": Object { "arguments": Object { @@ -28702,7 +29584,7 @@ Object { }, }, "variableScope": Object { - "$ref": 9, + "$ref": 6, }, "variables": Array [ Object { @@ -28713,7 +29595,7 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 9, + "$ref": 6, }, }, Object { @@ -28723,15 +29605,15 @@ Object { "name": Object { "name": "one", "range": Array [ - 38, - 47, + 25, + 34, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 167, + 100, ], "type": "FunctionDeclaration", }, @@ -28744,8 +29626,8 @@ Object { Object { "name": "one", "range": Array [ - 38, - 47, + 25, + 34, ], "type": "Identifier", }, @@ -28761,18 +29643,9 @@ Object { Object { "$ref": 5, }, - Object { - "$ref": 6, - }, - Object { - "$ref": 7, - }, - Object { - "$ref": 8, - }, ], "scope": Object { - "$ref": 9, + "$ref": 6, }, }, ], @@ -28784,15 +29657,15 @@ Object { "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 11, + "$ref": 8, }, "variableMap": Object { - "processOptionalElementParens": Object { + "processOptional": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 10, + "$ref": 7, }, "variables": Array [ Object { @@ -28800,17 +29673,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "processOptionalElementParens", + "name": "processOptional", "range": Array [ 9, - 37, + 24, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 167, + 100, ], "type": "FunctionDeclaration", }, @@ -28821,18 +29694,18 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "processOptionalElementParens", + "name": "processOptional", "range": Array [ 9, - 37, + 24, ], "type": "Identifier", }, ], - "name": "processOptionalElementParens", + "name": "processOptional", "references": Array [], "scope": Object { - "$ref": 10, + "$ref": 7, }, }, ], @@ -28846,7 +29719,7 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 11, + "$ref": 8, }, "variables": Array [], } diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call-with-non-null-assertion.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call-with-non-null-assertion.src.ts new file mode 100644 index 00000000000..c86387595e4 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call-with-non-null-assertion.src.ts @@ -0,0 +1,8 @@ +function processOptional(one?: any) { + one?.two!(); + one?.two!.three(); + (one?.two)!(); + (one?.two)!.three(); + (one?.two!)(); + (one?.two!).three(); +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access-with-non-null-assertion.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access-with-non-null-assertion.src.ts new file mode 100644 index 00000000000..ee4e7fc8451 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access-with-non-null-assertion.src.ts @@ -0,0 +1,8 @@ +function processOptional(one?: any) { + one?.['two']!.three; + (one?.['two'])!.three; + (one?.['two']!).three; + one?.two!['three']; + (one?.two)!['three']; + (one?.two!)['three']; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-with-non-null-assertion.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-with-non-null-assertion.src.ts new file mode 100644 index 00000000000..a7a94dcaa2b --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-with-non-null-assertion.src.ts @@ -0,0 +1,5 @@ +function processOptional(one?: any) { + one?.two!.three; + (one?.two)!.three; + (one?.two!).three; +} diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 1e693c58efc..66111f48840 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -18,6 +18,7 @@ import { isComputedProperty, isESTreeClassMember, isOptional, + isChildOptionalChain, unescapeStringLiteralText, TSError, } from './node-utils'; @@ -241,7 +242,11 @@ export class Converter { ): T { const result = data; if (!result.range) { - result.range = getRange(node, this.ast); + result.range = getRange( + // this is completely valid, but TS hates it + node as never, + this.ast, + ); } if (!result.loc) { result.loc = getLocFor(result.range[0], result.range[1], this.ast); @@ -1748,11 +1753,7 @@ export class Converter { const isLocallyOptional = node.questionDotToken !== undefined; // the optional expression should propagate 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; + const isChildOptional = isChildOptionalChain(node, object); if (isLocallyOptional || isChildOptional) { return this.createNode(node, { @@ -1780,11 +1781,7 @@ export class Converter { const isLocallyOptional = node.questionDotToken !== undefined; // the optional expression should propagate 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; + const isChildOptional = isChildOptionalChain(node, object); if (isLocallyOptional || isChildOptional) { return this.createNode(node, { @@ -1812,11 +1809,7 @@ export class Converter { const isLocallyOptional = node.questionDotToken !== undefined; // the optional expression should propagate 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; + const isChildOptional = isChildOptionalChain(node, callee); if (isLocallyOptional || isChildOptional) { result = this.createNode(node, { diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 6cbc6b0ba82..835c3f96269 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -1,4 +1,5 @@ import unescape from 'lodash/unescape'; +import * as semver from 'semver'; import * as ts from 'typescript'; import { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from './ts-estree'; @@ -448,6 +449,70 @@ export function isOptional(node: { : false; } +/** + * Returns true if the node is an optional chain node + */ +export function isOptionalChain( + node: TSESTree.Node, +): node is TSESTree.OptionalCallExpression | TSESTree.OptionalMemberExpression { + return ( + node.type === AST_NODE_TYPES.OptionalCallExpression || + node.type == AST_NODE_TYPES.OptionalMemberExpression + ); +} + +/** + * Returns true if the current TS version is TS 3.9 + */ +function isTSv3dot9(): boolean { + return !semver.satisfies(ts.version, '< 3.9.0 || < 3.9.1-rc || < 3.9.0-beta'); +} + +/** + * Returns true of the child of property access expression is an optional chain + */ +export function isChildOptionalChain( + node: + | ts.PropertyAccessExpression + | ts.ElementAccessExpression + | ts.CallExpression, + object: TSESTree.LeftHandSideExpression, +): boolean { + if ( + isOptionalChain(object) && + // (x?.y).z is semantically different, and as such .z is no longer optional + node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression + ) { + return true; + } + + if (!isTSv3dot9()) { + return false; + } + + // TS3.9 made a breaking change to how non-null works with optional chains. + // Pre-3.9, `x?.y!.z` means `(x?.y).z` - i.e. it essentially scrubbed the optionality from the chain + // Post-3.9, `x?.y!.z` means `x?.y!.z` - i.e. it just asserts that the property `y` is non-null, not the result of `x?.y` + + if ( + object.type !== AST_NODE_TYPES.TSNonNullExpression || + !isOptionalChain(object.expression) + ) { + return false; + } + + if ( + // make sure it's not (x.y)!.z + node.expression.kind === ts.SyntaxKind.NonNullExpression && + (node.expression as ts.NonNullExpression).expression.kind !== + ts.SyntaxKind.ParenthesizedExpression + ) { + return true; + } + + return false; +} + /** * Returns the type of a given ts.Token * @param token the ts.Token diff --git a/packages/typescript-estree/src/ts-estree/ts-nodes.ts b/packages/typescript-estree/src/ts-estree/ts-nodes.ts index 825aceab97d..2b8505d1fda 100644 --- a/packages/typescript-estree/src/ts-estree/ts-nodes.ts +++ b/packages/typescript-estree/src/ts-estree/ts-nodes.ts @@ -2,191 +2,188 @@ import * as ts from 'typescript'; export type TSToken = ts.Token; -export type TSNode = ts.Node & - ( - | ts.Modifier - | ts.Identifier - | ts.QualifiedName - | ts.ComputedPropertyName - | ts.Decorator - | ts.TypeParameterDeclaration - // | ts.SignatureDeclarationBase -> CallSignatureDeclaration, ConstructSignatureDeclaration - | ts.CallSignatureDeclaration - | ts.ConstructSignatureDeclaration - | ts.VariableDeclaration - | ts.VariableDeclarationList - | ts.ParameterDeclaration - | ts.BindingElement - | ts.PropertySignature - | ts.PropertyDeclaration - | ts.PropertyAssignment - | ts.ShorthandPropertyAssignment - | ts.SpreadAssignment - | ts.ObjectBindingPattern - | ts.ArrayBindingPattern - | ts.FunctionDeclaration - | ts.MethodSignature - | ts.MethodDeclaration - | ts.ConstructorDeclaration - | ts.SemicolonClassElement - | ts.GetAccessorDeclaration - | ts.SetAccessorDeclaration - | ts.IndexSignatureDeclaration - | ts.KeywordTypeNode // TODO: This node is bad, maybe we should report this - | ts.ImportTypeNode - | ts.ThisTypeNode - // | ts.FunctionOrConstructorTypeNodeBase -> FunctionTypeNode, ConstructorTypeNode - | ts.ConstructorTypeNode - | ts.FunctionTypeNode - | ts.TypeReferenceNode - | ts.TypePredicateNode - | ts.TypeQueryNode - | ts.TypeLiteralNode - | ts.ArrayTypeNode - | ts.TupleTypeNode - | ts.OptionalTypeNode - | ts.RestTypeNode - | ts.UnionTypeNode - | ts.IntersectionTypeNode - | ts.ConditionalTypeNode - | ts.InferTypeNode - | ts.ParenthesizedTypeNode - | ts.TypeOperatorNode - | ts.IndexedAccessTypeNode - | ts.MappedTypeNode - | ts.LiteralTypeNode - | ts.StringLiteral - | ts.OmittedExpression - | ts.PartiallyEmittedExpression - | ts.PrefixUnaryExpression - | ts.PostfixUnaryExpression - | ts.NullLiteral - | ts.BooleanLiteral - | ts.ThisExpression - | ts.SuperExpression - | ts.ImportExpression - | ts.DeleteExpression - | ts.TypeOfExpression - | ts.VoidExpression - | ts.AwaitExpression - | ts.YieldExpression - | ts.SyntheticExpression - | ts.BinaryExpression - | ts.ConditionalExpression - | ts.FunctionExpression - | ts.ArrowFunction - | ts.RegularExpressionLiteral - | ts.NoSubstitutionTemplateLiteral - | ts.NumericLiteral - | ts.BigIntLiteral - | ts.TemplateHead - | ts.TemplateMiddle - | ts.TemplateTail - | ts.TemplateExpression - | ts.TemplateSpan - | ts.ParenthesizedExpression - | ts.ArrayLiteralExpression - | ts.SpreadElement - | ts.ObjectLiteralExpression - | ts.PropertyAccessExpression - | ts.ElementAccessExpression - | ts.CallExpression - | ts.ExpressionWithTypeArguments - | ts.NewExpression - | ts.TaggedTemplateExpression - | ts.AsExpression - | ts.TypeAssertion - | ts.NonNullExpression - | ts.MetaProperty - | ts.JsxElement - | ts.JsxOpeningElement - | ts.JsxSelfClosingElement - | ts.JsxFragment - | ts.JsxOpeningFragment - | ts.JsxClosingFragment - | ts.JsxAttribute - | ts.JsxSpreadAttribute - | ts.JsxClosingElement - | ts.JsxExpression - | ts.JsxText - | ts.NotEmittedStatement - | ts.CommaListExpression - | ts.EmptyStatement - | ts.DebuggerStatement - | ts.MissingDeclaration - | ts.Block - | ts.VariableStatement - | ts.ExpressionStatement - | ts.IfStatement - | ts.DoStatement - | ts.WhileStatement - | ts.ForStatement - | ts.ForInStatement - | ts.ForOfStatement - | ts.BreakStatement - | ts.ContinueStatement - | ts.ReturnStatement - | ts.WithStatement - | ts.SwitchStatement - | ts.CaseBlock - | ts.CaseClause - | ts.DefaultClause - | ts.LabeledStatement - | ts.ThrowStatement - | ts.TryStatement - | ts.CatchClause - // | ts.ClassLikeDeclarationBase -> ClassDeclaration | ClassExpression - | ts.ClassDeclaration - | ts.ClassExpression - | ts.InterfaceDeclaration - | ts.HeritageClause - | ts.TypeAliasDeclaration - | ts.EnumMember - | ts.EnumDeclaration - | ts.ModuleDeclaration - | ts.ModuleBlock - | ts.ImportEqualsDeclaration - | ts.ExternalModuleReference - | ts.ImportDeclaration - | ts.ImportClause - | ts.NamespaceImport - | ts.NamespaceExportDeclaration - | ts.ExportDeclaration - | ts.NamedImports - | ts.NamedExports - | ts.ImportSpecifier - | ts.ExportSpecifier - | ts.ExportAssignment - | ts.CommentRange - | ts.SourceFile - | ts.Bundle - | ts.InputFiles - | ts.UnparsedSource - | ts.JsonMinusNumericLiteral +export type TSNode = + | ts.Modifier + | ts.Identifier + | ts.QualifiedName + | ts.ComputedPropertyName + | ts.Decorator + | ts.TypeParameterDeclaration + // | ts.SignatureDeclarationBase -> CallSignatureDeclaration, ConstructSignatureDeclaration + | ts.CallSignatureDeclaration + | ts.ConstructSignatureDeclaration + | ts.VariableDeclaration + | ts.VariableDeclarationList + | ts.ParameterDeclaration + | ts.BindingElement + | ts.PropertySignature + | ts.PropertyDeclaration + | ts.PropertyAssignment + | ts.ShorthandPropertyAssignment + | ts.SpreadAssignment + | ts.ObjectBindingPattern + | ts.ArrayBindingPattern + | ts.FunctionDeclaration + | ts.MethodSignature + | ts.MethodDeclaration + | ts.ConstructorDeclaration + | ts.SemicolonClassElement + | ts.GetAccessorDeclaration + | ts.SetAccessorDeclaration + | ts.IndexSignatureDeclaration + | ts.KeywordTypeNode // TODO: This node is bad, maybe we should report this + | ts.ImportTypeNode + | ts.ThisTypeNode + // | ts.FunctionOrConstructorTypeNodeBase -> FunctionTypeNode, ConstructorTypeNode + | ts.ConstructorTypeNode + | ts.FunctionTypeNode + | ts.TypeReferenceNode + | ts.TypePredicateNode + | ts.TypeQueryNode + | ts.TypeLiteralNode + | ts.ArrayTypeNode + | ts.TupleTypeNode + | ts.OptionalTypeNode + | ts.RestTypeNode + | ts.UnionTypeNode + | ts.IntersectionTypeNode + | ts.ConditionalTypeNode + | ts.InferTypeNode + | ts.ParenthesizedTypeNode + | ts.TypeOperatorNode + | ts.IndexedAccessTypeNode + | ts.MappedTypeNode + | ts.LiteralTypeNode + | ts.StringLiteral + | ts.OmittedExpression + | ts.PartiallyEmittedExpression + | ts.PrefixUnaryExpression + | ts.PostfixUnaryExpression + | ts.NullLiteral + | ts.BooleanLiteral + | ts.ThisExpression + | ts.SuperExpression + | ts.ImportExpression + | ts.DeleteExpression + | ts.TypeOfExpression + | ts.VoidExpression + | ts.AwaitExpression + | ts.YieldExpression + | ts.SyntheticExpression + | ts.BinaryExpression + | ts.ConditionalExpression + | ts.FunctionExpression + | ts.ArrowFunction + | ts.RegularExpressionLiteral + | ts.NoSubstitutionTemplateLiteral + | ts.NumericLiteral + | ts.BigIntLiteral + | ts.TemplateHead + | ts.TemplateMiddle + | ts.TemplateTail + | ts.TemplateExpression + | ts.TemplateSpan + | ts.ParenthesizedExpression + | ts.ArrayLiteralExpression + | ts.SpreadElement + | ts.ObjectLiteralExpression + | ts.PropertyAccessExpression + | ts.ElementAccessExpression + | ts.CallExpression + | ts.ExpressionWithTypeArguments + | ts.NewExpression + | ts.TaggedTemplateExpression + | ts.AsExpression + | ts.TypeAssertion + | ts.NonNullExpression + | ts.MetaProperty + | ts.JsxElement + | ts.JsxOpeningElement + | ts.JsxSelfClosingElement + | ts.JsxFragment + | ts.JsxOpeningFragment + | ts.JsxClosingFragment + | ts.JsxAttribute + | ts.JsxSpreadAttribute + | ts.JsxClosingElement + | ts.JsxExpression + | ts.JsxText + | ts.NotEmittedStatement + | ts.CommaListExpression + | ts.EmptyStatement + | ts.DebuggerStatement + | ts.MissingDeclaration + | ts.Block + | ts.VariableStatement + | ts.ExpressionStatement + | ts.IfStatement + | ts.DoStatement + | ts.WhileStatement + | ts.ForStatement + | ts.ForInStatement + | ts.ForOfStatement + | ts.BreakStatement + | ts.ContinueStatement + | ts.ReturnStatement + | ts.WithStatement + | ts.SwitchStatement + | ts.CaseBlock + | ts.CaseClause + | ts.DefaultClause + | ts.LabeledStatement + | ts.ThrowStatement + | ts.TryStatement + | ts.CatchClause + // | ts.ClassLikeDeclarationBase -> ClassDeclaration | ClassExpression + | ts.ClassDeclaration + | ts.ClassExpression + | ts.InterfaceDeclaration + | ts.HeritageClause + | ts.TypeAliasDeclaration + | ts.EnumMember + | ts.EnumDeclaration + | ts.ModuleDeclaration + | ts.ModuleBlock + | ts.ImportEqualsDeclaration + | ts.ExternalModuleReference + | ts.ImportDeclaration + | ts.ImportClause + | ts.NamespaceImport + | ts.NamespaceExportDeclaration + | ts.ExportDeclaration + | ts.NamedImports + | ts.NamedExports + | ts.ImportSpecifier + | ts.ExportSpecifier + | ts.ExportAssignment + | ts.SourceFile + | ts.Bundle + | ts.InputFiles + | ts.UnparsedSource + | ts.JsonMinusNumericLiteral - // JSDoc: Unsupported - | ts.JSDoc - | ts.JSDocTypeExpression - | ts.JSDocUnknownTag - | ts.JSDocAugmentsTag - | ts.JSDocClassTag - | ts.JSDocEnumTag - | ts.JSDocThisTag - | ts.JSDocTemplateTag - | ts.JSDocReturnTag - | ts.JSDocTypeTag - | ts.JSDocTypedefTag - | ts.JSDocCallbackTag - | ts.JSDocSignature - | ts.JSDocPropertyTag - | ts.JSDocParameterTag - | ts.JSDocTypeLiteral - | ts.JSDocFunctionType - | ts.JSDocAllType - | ts.JSDocUnknownType - | ts.JSDocNullableType - | ts.JSDocNonNullableType - | ts.JSDocOptionalType - | ts.JSDocVariadicType - | ts.JSDocAuthorTag - ); + // JSDoc: Unsupported + | ts.JSDoc + | ts.JSDocTypeExpression + | ts.JSDocUnknownTag + | ts.JSDocAugmentsTag + | ts.JSDocClassTag + | ts.JSDocEnumTag + | ts.JSDocThisTag + | ts.JSDocTemplateTag + | ts.JSDocReturnTag + | ts.JSDocTypeTag + | ts.JSDocTypedefTag + | ts.JSDocCallbackTag + | ts.JSDocSignature + | ts.JSDocPropertyTag + | ts.JSDocParameterTag + | ts.JSDocTypeLiteral + | ts.JSDocFunctionType + | ts.JSDocAllType + | ts.JSDocUnknownType + | ts.JSDocNullableType + | ts.JSDocNonNullableType + | ts.JSDocOptionalType + | ts.JSDocVariadicType + | ts.JSDocAuthorTag; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap index 82c53ddf8cb..448b85afda1 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap @@ -6,6 +6,7 @@ Object { "bindDiagnostics": Array [], "bindSuggestionDiagnostics": undefined, "checkJsDirective": undefined, + "commentDirectives": undefined, "endOfFileToken": Object { "loc": Object { "end": Object { 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 ad2d0923801..124cc7cde04 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 @@ -1994,12 +1994,18 @@ 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-non-null-assertion.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-non-null-assertion.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-non-null-assertion.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"`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index 800d7042f2c..5143a42c849 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -85525,7 +85525,7 @@ Object { } `; -exports[`typescript fixtures/basics/optional-chain-call-with-parens.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-call-with-non-null-assertion.src 1`] = ` Object { "body": Array [ Object { @@ -85536,74 +85536,91 @@ 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 { + "expression": Object { + "computed": false, "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 2, }, "start": Object { - "column": 3, + "column": 2, "line": 2, }, }, - "name": "one", - "range": Array [ - 51, - 54, - ], - "type": "Identifier", - }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, }, - "start": Object { - "column": 8, - "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", }, - "name": "fn", "range": Array [ - 56, - 58, + 40, + 48, ], - "type": "Identifier", + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, }, "range": Array [ - 51, - 58, + 40, + 49, ], - "type": "OptionalMemberExpression", + "type": "TSNonNullExpression", }, "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 2, }, "start": Object { - "column": 3, + "column": 2, "line": 2, }, }, "optional": false, "range": Array [ + 40, 51, - 60, ], "type": "OptionalCallExpression", }, @@ -85618,8 +85635,8 @@ Object { }, }, "range": Array [ - 50, - 62, + 40, + 52, ], "type": "ExpressionStatement", }, @@ -85630,7 +85647,7 @@ Object { "computed": false, "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 3, }, "start": Object { @@ -85639,88 +85656,105 @@ Object { }, }, "object": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 3, - "line": 3, - }, - }, - "object": Object { + "expression": Object { + "computed": false, "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 3, }, "start": Object { - "column": 3, + "column": 2, "line": 3, }, }, - "name": "one", - "range": Array [ - 66, - 69, - ], - "type": "Identifier", - }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, }, - "start": Object { - "column": 8, - "line": 3, + "name": "one", + "range": Array [ + 55, + 58, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, }, + "name": "two", + "range": Array [ + 60, + 63, + ], + "type": "Identifier", }, - "name": "two", "range": Array [ - 71, - 74, + 55, + 63, ], - "type": "Identifier", + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, }, "range": Array [ - 66, - 74, + 55, + 64, ], - "type": "OptionalMemberExpression", + "type": "TSNonNullExpression", }, "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 3, }, "start": Object { - "column": 13, + "column": 12, "line": 3, }, }, - "name": "fn", + "name": "three", "range": Array [ - 76, - 78, + 65, + 70, ], "type": "Identifier", }, "range": Array [ - 65, - 78, + 55, + 70, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 17, + "column": 19, "line": 3, }, "start": Object { @@ -85730,14 +85764,14 @@ Object { }, "optional": false, "range": Array [ - 65, - 80, + 55, + 72, ], - "type": "CallExpression", + "type": "OptionalCallExpression", }, "loc": Object { "end": Object { - "column": 18, + "column": 20, "line": 3, }, "start": Object { @@ -85746,8 +85780,8 @@ Object { }, }, "range": Array [ - 65, - 81, + 55, + 73, ], "type": "ExpressionStatement", }, @@ -85755,22 +85789,11 @@ 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 { + "expression": Object { "computed": false, "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 4, }, "start": Object { @@ -85791,81 +85814,72 @@ Object { }, "name": "one", "range": Array [ - 85, - 88, + 77, + 80, ], "type": "Identifier", }, - "optional": false, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 4, }, "start": Object { - "column": 7, + "column": 8, "line": 4, }, }, "name": "two", "range": Array [ - 89, - 92, + 82, + 85, ], "type": "Identifier", }, "range": Array [ + 77, 85, - 92, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 4, - }, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, }, - "name": "fn", - "range": Array [ - 94, - 96, - ], - "type": "Identifier", }, "range": Array [ - 85, - 96, + 76, + 87, ], - "type": "OptionalMemberExpression", + "type": "TSNonNullExpression", }, "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 4, }, "start": Object { - "column": 3, + "column": 2, "line": 4, }, }, "optional": false, "range": Array [ - 85, - 98, + 76, + 89, ], - "type": "OptionalCallExpression", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 4, }, "start": Object { @@ -85874,8 +85888,8 @@ Object { }, }, "range": Array [ - 84, - 100, + 76, + 90, ], "type": "ExpressionStatement", }, @@ -85886,7 +85900,7 @@ Object { "computed": false, "loc": Object { "end": Object { - "column": 21, + "column": 19, "line": 5, }, "start": Object { @@ -85895,22 +85909,11 @@ Object { }, }, "object": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 3, - "line": 5, - }, - }, - "object": Object { + "expression": Object { "computed": false, "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 5, }, "start": Object { @@ -85931,89 +85934,80 @@ Object { }, "name": "one", "range": Array [ - 104, - 107, + 94, + 97, ], "type": "Identifier", }, - "optional": false, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 5, }, "start": Object { - "column": 7, + "column": 8, "line": 5, }, }, "name": "two", "range": Array [ - 108, - 111, + 99, + 102, ], "type": "Identifier", }, "range": Array [ - 104, - 111, + 94, + 102, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 12, - "line": 5, - }, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, }, - "name": "three", - "range": Array [ - 113, - 118, - ], - "type": "Identifier", }, "range": Array [ + 93, 104, - 118, ], - "type": "OptionalMemberExpression", + "type": "TSNonNullExpression", }, "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 21, + "column": 19, "line": 5, }, "start": Object { - "column": 19, + "column": 14, "line": 5, }, }, - "name": "fn", + "name": "three", "range": Array [ - 120, - 122, + 105, + 110, ], "type": "Identifier", }, "range": Array [ - 103, - 122, + 93, + 110, ], "type": "MemberExpression", }, "loc": Object { "end": Object { - "column": 23, + "column": 21, "line": 5, }, "start": Object { @@ -86023,14 +86017,14 @@ Object { }, "optional": false, "range": Array [ - 103, - 124, + 93, + 112, ], "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 24, + "column": 22, "line": 5, }, "start": Object { @@ -86039,8 +86033,8 @@ Object { }, }, "range": Array [ - 103, - 125, + 93, + 113, ], "type": "ExpressionStatement", }, @@ -86048,22 +86042,11 @@ 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 { + "expression": Object { "computed": false, "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 6, }, "start": Object { @@ -86072,10 +86055,9 @@ Object { }, }, "object": Object { - "computed": false, "loc": Object { "end": Object { - "column": 10, + "column": 6, "line": 6, }, "start": Object { @@ -86083,119 +86065,74 @@ Object { "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", - }, + "name": "one", "range": Array [ - 129, - 136, + 117, + 120, ], - "type": "MemberExpression", + "type": "Identifier", }, "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 6, }, "start": Object { - "column": 12, + "column": 8, "line": 6, }, }, - "name": "three", + "name": "two", "range": Array [ - 138, - 143, + 122, + 125, ], "type": "Identifier", }, "range": Array [ - 129, - 143, + 117, + 125, ], "type": "OptionalMemberExpression", }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 6, - }, - "start": Object { - "column": 19, - "line": 6, - }, + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, }, - "name": "fn", - "range": Array [ - 145, - 147, - ], - "type": "Identifier", }, "range": Array [ - 129, - 147, + 117, + 126, ], - "type": "OptionalMemberExpression", + "type": "TSNonNullExpression", }, "loc": Object { "end": Object { - "column": 23, + "column": 15, "line": 6, }, "start": Object { - "column": 3, + "column": 2, "line": 6, }, }, "optional": false, "range": Array [ + 116, 129, - 149, ], - "type": "OptionalCallExpression", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 25, + "column": 16, "line": 6, }, "start": Object { @@ -86204,8 +86141,8 @@ Object { }, }, "range": Array [ - 128, - 151, + 116, + 130, ], "type": "ExpressionStatement", }, @@ -86213,290 +86150,144 @@ Object { "expression": Object { "arguments": Array [], "callee": Object { + "computed": false, "loc": Object { "end": Object { - "column": 6, - "line": 8, + "column": 19, + "line": 7, }, "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, + "column": 2, + "line": 7, + }, }, - }, - "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 { + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "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 [ + 134, + 137, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": "two", + "range": Array [ + 139, + 142, + ], + "type": "Identifier", + }, + "range": Array [ + 134, + 142, + ], + "type": "OptionalMemberExpression", + }, "loc": Object { "end": Object { - "column": 6, - "line": 9, + "column": 12, + "line": 7, }, "start": Object { "column": 3, - "line": 9, + "line": 7, }, }, - "name": "one", "range": Array [ - 169, - 172, + 134, + 143, ], - "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, + "type": "TSNonNullExpression", }, - }, - "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 { + "optional": false, + "property": Object { "loc": Object { "end": Object { - "column": 6, - "line": 10, + "column": 19, + "line": 7, }, "start": Object { - "column": 3, - "line": 10, + "column": 14, + "line": 7, }, }, - "name": "one", + "name": "three", "range": Array [ - 184, - 187, + 145, + 150, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 10, - "line": 10, - }, - "start": Object { - "column": 3, - "line": 10, - }, - }, - "optional": true, "range": Array [ - 184, - 191, + 133, + 150, ], - "type": "OptionalCallExpression", + "type": "MemberExpression", }, "loc": Object { "end": Object { - "column": 15, - "line": 10, + "column": 21, + "line": 7, }, "start": Object { "column": 2, - "line": 10, + "line": 7, }, }, - "optional": true, + "optional": false, "range": Array [ - 183, - 196, + 133, + 152, ], - "type": "OptionalCallExpression", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 16, - "line": 10, + "column": 22, + "line": 7, }, "start": Object { "column": 2, - "line": 10, + "line": 7, }, }, "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": 6, - "line": 12, - }, - "start": Object { - "column": 3, - "line": 12, - }, - }, - "name": "one", - "range": Array [ - 202, - 205, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 10, - "line": 12, - }, - "start": Object { - "column": 3, - "line": 12, - }, - }, - "optional": true, - "range": Array [ - 202, - 209, - ], - "type": "OptionalCallExpression", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 12, - }, - "start": Object { - "column": 12, - "line": 12, - }, - }, - "name": "two", - "range": Array [ - 211, - 214, - ], - "type": "Identifier", - }, - "range": Array [ - 201, - 214, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 12, - }, - "start": Object { - "column": 2, - "line": 12, - }, - }, - "range": Array [ - 201, - 215, + 133, + 153, ], "type": "ExpressionStatement", }, @@ -86504,16 +86295,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 13, + "line": 8, }, "start": Object { - "column": 46, + "column": 36, "line": 1, }, }, "range": Array [ - 46, - 217, + 36, + 155, ], "type": "BlockStatement", }, @@ -86522,7 +86313,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 34, + "column": 24, "line": 1, }, "start": Object { @@ -86530,17 +86321,17 @@ Object { "line": 1, }, }, - "name": "processOptionalCallParens", + "name": "processOptional", "range": Array [ 9, - 34, + 24, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 13, + "line": 8, }, "start": Object { "column": 0, @@ -86551,51 +86342,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 44, + "column": 34, "line": 1, }, "start": Object { - "column": 35, + "column": 25, "line": 1, }, }, "name": "one", "optional": true, "range": Array [ - 35, - 44, + 25, + 34, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 44, + "column": 34, "line": 1, }, "start": Object { - "column": 39, + "column": 29, "line": 1, }, }, "range": Array [ - 39, - 44, + 29, + 34, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 44, + "column": 34, "line": 1, }, "start": Object { - "column": 41, + "column": 31, "line": 1, }, }, "range": Array [ - 41, - 44, + 31, + 34, ], "type": "TSAnyKeyword", }, @@ -86604,7 +86395,7 @@ Object { ], "range": Array [ 0, - 217, + 155, ], "type": "FunctionDeclaration", }, @@ -86612,7 +86403,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 14, + "line": 9, }, "start": Object { "column": 0, @@ -86621,7 +86412,7 @@ Object { }, "range": Array [ 0, - 218, + 156, ], "sourceType": "script", "tokens": Array [ @@ -86646,7 +86437,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 24, "line": 1, }, "start": Object { @@ -86656,25 +86447,25 @@ Object { }, "range": Array [ 9, - 34, + 24, ], "type": "Identifier", - "value": "processOptionalCallParens", + "value": "processOptional", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 25, "line": 1, }, "start": Object { - "column": 34, + "column": 24, "line": 1, }, }, "range": Array [ - 34, - 35, + 24, + 25, ], "type": "Punctuator", "value": "(", @@ -86682,17 +86473,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 28, "line": 1, }, "start": Object { - "column": 35, + "column": 25, "line": 1, }, }, "range": Array [ - 35, - 38, + 25, + 28, ], "type": "Identifier", "value": "one", @@ -86700,17 +86491,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, + "column": 29, "line": 1, }, "start": Object { - "column": 38, + "column": 28, "line": 1, }, }, "range": Array [ - 38, - 39, + 28, + 29, ], "type": "Punctuator", "value": "?", @@ -86718,17 +86509,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 40, + "column": 30, "line": 1, }, "start": Object { - "column": 39, + "column": 29, "line": 1, }, }, "range": Array [ - 39, - 40, + 29, + 30, ], "type": "Punctuator", "value": ":", @@ -86736,17 +86527,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 44, + "column": 34, "line": 1, }, "start": Object { - "column": 41, + "column": 31, "line": 1, }, }, "range": Array [ - 41, - 44, + 31, + 34, ], "type": "Identifier", "value": "any", @@ -86754,17 +86545,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, + "column": 35, "line": 1, }, "start": Object { - "column": 44, + "column": 34, "line": 1, }, }, "range": Array [ - 44, - 45, + 34, + 35, ], "type": "Punctuator", "value": ")", @@ -86772,17 +86563,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 47, + "column": 37, "line": 1, }, "start": Object { - "column": 46, + "column": 36, "line": 1, }, }, "range": Array [ - 46, - 47, + 36, + 37, ], "type": "Punctuator", "value": "{", @@ -86790,7 +86581,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 2, }, "start": Object { @@ -86799,26 +86590,8 @@ Object { }, }, "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 2, - }, - "start": Object { - "column": 3, - "line": 2, - }, - }, - "range": Array [ - 51, - 54, + 40, + 43, ], "type": "Identifier", "value": "one", @@ -86826,17 +86599,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 7, "line": 2, }, "start": Object { - "column": 6, + "column": 5, "line": 2, }, }, "range": Array [ - 54, - 56, + 43, + 45, ], "type": "Punctuator", "value": "?.", @@ -86848,16 +86621,16 @@ Object { "line": 2, }, "start": Object { - "column": 8, + "column": 7, "line": 2, }, }, "range": Array [ - 56, - 58, + 45, + 48, ], "type": "Identifier", - "value": "fn", + "value": "two", }, Object { "loc": Object { @@ -86871,11 +86644,11 @@ Object { }, }, "range": Array [ - 58, - 59, + 48, + 49, ], "type": "Punctuator", - "value": "(", + "value": "!", }, Object { "loc": Object { @@ -86889,11 +86662,11 @@ Object { }, }, "range": Array [ - 59, - 60, + 49, + 50, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { @@ -86907,8 +86680,8 @@ Object { }, }, "range": Array [ - 60, - 61, + 50, + 51, ], "type": "Punctuator", "value": ")", @@ -86925,8 +86698,8 @@ Object { }, }, "range": Array [ - 61, - 62, + 51, + 52, ], "type": "Punctuator", "value": ";", @@ -86934,7 +86707,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 3, }, "start": Object { @@ -86943,62 +86716,44 @@ Object { }, }, "range": Array [ - 65, - 66, + 55, + 58, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 7, "line": 3, }, "start": Object { - "column": 3, + "column": 5, "line": 3, }, }, "range": Array [ - 66, - 69, + 58, + 60, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 3, }, "start": Object { - "column": 6, + "column": 7, "line": 3, }, }, "range": Array [ - 69, - 71, - ], - "type": "Punctuator", - "value": "?.", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 71, - 74, + 60, + 63, ], "type": "Identifier", "value": "two", @@ -87006,35 +86761,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 11, "line": 3, }, "start": Object { - "column": 11, + "column": 10, "line": 3, }, }, "range": Array [ - 74, - 75, + 63, + 64, ], "type": "Punctuator", - "value": ")", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 3, }, "start": Object { - "column": 12, + "column": 11, "line": 3, }, }, "range": Array [ - 75, - 76, + 64, + 65, ], "type": "Punctuator", "value": ".", @@ -87042,35 +86797,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 3, }, "start": Object { - "column": 13, + "column": 12, "line": 3, }, }, "range": Array [ - 76, - 78, + 65, + 70, ], "type": "Identifier", - "value": "fn", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 18, "line": 3, }, "start": Object { - "column": 15, + "column": 17, "line": 3, }, }, "range": Array [ - 78, - 79, + 70, + 71, ], "type": "Punctuator", "value": "(", @@ -87078,17 +86833,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 19, "line": 3, }, "start": Object { - "column": 16, + "column": 18, "line": 3, }, }, "range": Array [ - 79, - 80, + 71, + 72, ], "type": "Punctuator", "value": ")", @@ -87096,17 +86851,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 20, "line": 3, }, "start": Object { - "column": 17, + "column": 19, "line": 3, }, }, "range": Array [ - 80, - 81, + 72, + 73, ], "type": "Punctuator", "value": ";", @@ -87123,8 +86878,8 @@ Object { }, }, "range": Array [ - 84, - 85, + 76, + 77, ], "type": "Punctuator", "value": "(", @@ -87141,8 +86896,8 @@ Object { }, }, "range": Array [ - 85, - 88, + 77, + 80, ], "type": "Identifier", "value": "one", @@ -87150,7 +86905,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 8, "line": 4, }, "start": Object { @@ -87159,26 +86914,26 @@ Object { }, }, "range": Array [ - 88, - 89, + 80, + 82, ], "type": "Punctuator", - "value": ".", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 4, }, "start": Object { - "column": 7, + "column": 8, "line": 4, }, }, "range": Array [ - 89, - 92, + 82, + 85, ], "type": "Identifier", "value": "two", @@ -87190,21 +86945,21 @@ Object { "line": 4, }, "start": Object { - "column": 10, + "column": 11, "line": 4, }, }, "range": Array [ - 92, - 94, + 85, + 86, ], "type": "Punctuator", - "value": "?.", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 4, }, "start": Object { @@ -87213,26 +86968,26 @@ Object { }, }, "range": Array [ - 94, - 96, + 86, + 87, ], - "type": "Identifier", - "value": "fn", + "type": "Punctuator", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 4, }, "start": Object { - "column": 14, + "column": 13, "line": 4, }, }, "range": Array [ - 96, - 97, + 87, + 88, ], "type": "Punctuator", "value": "(", @@ -87240,35 +86995,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, - }, - "start": Object { "column": 15, "line": 4, }, - }, - "range": Array [ - 97, - 98, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, "start": Object { - "column": 16, + "column": 14, "line": 4, }, }, "range": Array [ - 98, - 99, + 88, + 89, ], "type": "Punctuator", "value": ")", @@ -87276,17 +87013,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 4, }, "start": Object { - "column": 17, + "column": 15, "line": 4, }, }, "range": Array [ - 99, - 100, + 89, + 90, ], "type": "Punctuator", "value": ";", @@ -87303,8 +87040,8 @@ Object { }, }, "range": Array [ - 103, - 104, + 93, + 94, ], "type": "Punctuator", "value": "(", @@ -87321,8 +87058,8 @@ Object { }, }, "range": Array [ - 104, - 107, + 94, + 97, ], "type": "Identifier", "value": "one", @@ -87330,7 +87067,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 8, "line": 5, }, "start": Object { @@ -87339,26 +87076,26 @@ Object { }, }, "range": Array [ - 107, - 108, + 97, + 99, ], "type": "Punctuator", - "value": ".", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 5, }, "start": Object { - "column": 7, + "column": 8, "line": 5, }, }, "range": Array [ - 108, - 111, + 99, + 102, ], "type": "Identifier", "value": "two", @@ -87370,21 +87107,21 @@ Object { "line": 5, }, "start": Object { - "column": 10, + "column": 11, "line": 5, }, }, "range": Array [ - 111, - 113, + 102, + 103, ], "type": "Punctuator", - "value": "?.", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 13, "line": 5, }, "start": Object { @@ -87393,44 +87130,26 @@ Object { }, }, "range": Array [ - 113, - 118, - ], - "type": "Identifier", - "value": "three", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 5, - }, - "start": Object { - "column": 17, - "line": 5, - }, - }, - "range": Array [ - 118, - 119, + 103, + 104, ], "type": "Punctuator", - "value": ")", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 14, "line": 5, }, "start": Object { - "column": 18, + "column": 13, "line": 5, }, }, "range": Array [ - 119, - 120, + 104, + 105, ], "type": "Punctuator", "value": ".", @@ -87438,35 +87157,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 19, "line": 5, }, "start": Object { - "column": 19, + "column": 14, "line": 5, }, }, "range": Array [ - 120, - 122, + 105, + 110, ], "type": "Identifier", - "value": "fn", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 20, "line": 5, }, "start": Object { - "column": 21, + "column": 19, "line": 5, }, }, "range": Array [ - 122, - 123, + 110, + 111, ], "type": "Punctuator", "value": "(", @@ -87474,17 +87193,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 21, "line": 5, }, "start": Object { - "column": 22, + "column": 20, "line": 5, }, }, "range": Array [ - 123, - 124, + 111, + 112, ], "type": "Punctuator", "value": ")", @@ -87492,17 +87211,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 22, "line": 5, }, "start": Object { - "column": 23, + "column": 21, "line": 5, }, }, "range": Array [ - 124, - 125, + 112, + 113, ], "type": "Punctuator", "value": ";", @@ -87519,8 +87238,8 @@ Object { }, }, "range": Array [ - 128, - 129, + 116, + 117, ], "type": "Punctuator", "value": "(", @@ -87537,8 +87256,8 @@ Object { }, }, "range": Array [ - 129, - 132, + 117, + 120, ], "type": "Identifier", "value": "one", @@ -87546,7 +87265,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 8, "line": 6, }, "start": Object { @@ -87555,26 +87274,26 @@ Object { }, }, "range": Array [ - 132, - 133, + 120, + 122, ], "type": "Punctuator", - "value": ".", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 6, }, "start": Object { - "column": 7, + "column": 8, "line": 6, }, }, "range": Array [ - 133, - 136, + 122, + 125, ], "type": "Identifier", "value": "two", @@ -87586,21 +87305,21 @@ Object { "line": 6, }, "start": Object { - "column": 10, + "column": 11, "line": 6, }, }, "range": Array [ - 136, - 138, + 125, + 126, ], "type": "Punctuator", - "value": "?.", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 13, "line": 6, }, "start": Object { @@ -87609,62 +87328,26 @@ Object { }, }, "range": Array [ - 138, - 143, - ], - "type": "Identifier", - "value": "three", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 6, - }, - "start": Object { - "column": 17, - "line": 6, - }, - }, - "range": Array [ - 143, - 145, + 126, + 127, ], "type": "Punctuator", - "value": "?.", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 6, - }, - "start": Object { - "column": 19, - "line": 6, - }, - }, - "range": Array [ - 145, - 147, - ], - "type": "Identifier", - "value": "fn", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 14, "line": 6, }, "start": Object { - "column": 21, + "column": 13, "line": 6, }, }, "range": Array [ - 147, - 148, + 127, + 128, ], "type": "Punctuator", "value": "(", @@ -87672,35 +87355,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 6, - }, - "start": Object { - "column": 22, - "line": 6, - }, - }, - "range": Array [ - 148, - 149, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, + "column": 15, "line": 6, }, "start": Object { - "column": 23, + "column": 14, "line": 6, }, }, "range": Array [ - 149, - 150, + 128, + 129, ], "type": "Punctuator", "value": ")", @@ -87708,17 +87373,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 16, "line": 6, }, "start": Object { - "column": 24, + "column": 15, "line": 6, }, }, "range": Array [ - 150, - 151, + 129, + 130, ], "type": "Punctuator", "value": ";", @@ -87727,16 +87392,16 @@ Object { "loc": Object { "end": Object { "column": 3, - "line": 8, + "line": 7, }, "start": Object { "column": 2, - "line": 8, + "line": 7, }, }, "range": Array [ - 155, - 156, + 133, + 134, ], "type": "Punctuator", "value": "(", @@ -87745,16 +87410,16 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 8, + "line": 7, }, "start": Object { "column": 3, - "line": 8, + "line": 7, }, }, "range": Array [ - 156, - 159, + 134, + 137, ], "type": "Identifier", "value": "one", @@ -87763,16 +87428,16 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 8, + "line": 7, }, "start": Object { "column": 6, - "line": 8, + "line": 7, }, }, "range": Array [ - 159, - 161, + 137, + 139, ], "type": "Punctuator", "value": "?.", @@ -87780,53 +87445,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 8, + "column": 11, + "line": 7, }, "start": Object { "column": 8, - "line": 8, + "line": 7, }, }, "range": Array [ - 161, - 162, + 139, + 142, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 8, + "column": 12, + "line": 7, }, "start": Object { - "column": 9, - "line": 8, + "column": 11, + "line": 7, }, }, "range": Array [ - 162, - 163, + 142, + 143, ], "type": "Punctuator", - "value": ")", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 8, + "column": 13, + "line": 7, }, "start": Object { - "column": 10, - "line": 8, + "column": 12, + "line": 7, }, }, "range": Array [ - 163, - 164, + 143, + 144, ], "type": "Punctuator", "value": ")", @@ -87834,615 +87499,201 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 8, + "column": 14, + "line": 7, }, "start": Object { - "column": 11, - "line": 8, + "column": 13, + "line": 7, }, }, "range": Array [ - 164, - 165, + 144, + 145, ], "type": "Punctuator", - "value": ";", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 9, + "column": 19, + "line": 7, }, "start": Object { - "column": 2, - "line": 9, + "column": 14, + "line": 7, }, }, "range": Array [ - 168, - 169, + 145, + 150, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 9, + "column": 20, + "line": 7, }, "start": Object { - "column": 3, - "line": 9, + "column": 19, + "line": 7, }, }, "range": Array [ - 169, - 172, + 150, + 151, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 9, + "column": 21, + "line": 7, }, "start": Object { - "column": 6, - "line": 9, + "column": 20, + "line": 7, }, }, "range": Array [ - 172, - 174, + 151, + 152, ], "type": "Punctuator", - "value": "?.", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 9, + "column": 22, + "line": 7, }, "start": Object { - "column": 8, - "line": 9, + "column": 21, + "line": 7, }, }, "range": Array [ - 174, - 175, + 152, + 153, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 9, + "column": 1, + "line": 8, }, "start": Object { - "column": 9, - "line": 9, - }, - }, - "range": Array [ - 175, - 176, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 9, - }, - "start": Object { - "column": 10, - "line": 9, - }, - }, - "range": Array [ - 176, - 177, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 9, - }, - "start": Object { - "column": 11, - "line": 9, - }, - }, - "range": Array [ - 177, - 178, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 9, - }, - "start": Object { - "column": 12, - "line": 9, - }, - }, - "range": Array [ - 178, - 179, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 9, - }, - "start": Object { - "column": 13, - "line": 9, - }, - }, - "range": Array [ - 179, - 180, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 10, - }, - "start": Object { - "column": 2, - "line": 10, - }, - }, - "range": Array [ - 183, - 184, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 10, - }, - "start": Object { - "column": 3, - "line": 10, - }, - }, - "range": Array [ - 184, - 187, - ], - "type": "Identifier", - "value": "one", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 10, - }, - "start": Object { - "column": 6, - "line": 10, - }, - }, - "range": Array [ - 187, - 189, - ], - "type": "Punctuator", - "value": "?.", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 10, - }, - "start": Object { - "column": 8, - "line": 10, - }, - }, - "range": Array [ - 189, - 190, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 10, - }, - "start": Object { - "column": 9, - "line": 10, - }, - }, - "range": Array [ - 190, - 191, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 10, - }, - "start": Object { - "column": 10, - "line": 10, - }, - }, - "range": Array [ - 191, - 192, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 10, - }, - "start": Object { - "column": 11, - "line": 10, - }, - }, - "range": Array [ - 192, - 194, - ], - "type": "Punctuator", - "value": "?.", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 10, - }, - "start": Object { - "column": 13, - "line": 10, - }, - }, - "range": Array [ - 194, - 195, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 10, - }, - "start": Object { - "column": 14, - "line": 10, + "column": 0, + "line": 8, }, }, "range": Array [ - 195, - 196, + 154, + 155, ], "type": "Punctuator", - "value": ")", + "value": "}", }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 10, - }, - "start": Object { - "column": 15, - "line": 10, - }, - }, - "range": Array [ - 196, - 197, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 12, - }, - "start": Object { - "column": 2, - "line": 12, - }, - }, - "range": Array [ - 201, - 202, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 12, - }, - "start": Object { - "column": 3, - "line": 12, - }, - }, - "range": Array [ - 202, - 205, - ], - "type": "Identifier", - "value": "one", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 12, - }, - "start": Object { - "column": 6, - "line": 12, - }, - }, - "range": Array [ - 205, - 207, - ], - "type": "Punctuator", - "value": "?.", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 12, - }, - "start": Object { - "column": 8, - "line": 12, - }, - }, - "range": Array [ - 207, - 208, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 12, - }, - "start": Object { - "column": 9, - "line": 12, - }, - }, - "range": Array [ - 208, - 209, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 12, - }, - "start": Object { - "column": 10, - "line": 12, - }, - }, - "range": Array [ - 209, - 210, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 12, - }, - "start": Object { - "column": 11, - "line": 12, - }, - }, - "range": Array [ - 210, - 211, - ], - "type": "Punctuator", - "value": ".", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 12, - }, - "start": Object { - "column": 12, - "line": 12, - }, - }, - "range": Array [ - 211, - 214, - ], - "type": "Identifier", - "value": "two", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 12, - }, - "start": Object { - "column": 15, - "line": 12, - }, - }, - "range": Array [ - 214, - 215, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 13, - }, - "start": Object { - "column": 0, - "line": 13, - }, - }, - "range": Array [ - 216, - 217, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` -Object { - "body": Array [ + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/optional-chain-call-with-parens.src 1`] = ` +Object { + "body": Array [ Object { "async": false, "body": Object { "body": Array [ Object { "expression": Object { - "computed": true, - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "object": Object { + "arguments": Array [], + "callee": Object { + "computed": false, "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 2, }, "start": Object { - "column": 2, + "column": 3, "line": 2, }, }, - "name": "one", - "range": Array [ - 47, - 50, - ], - "type": "Identifier", - }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, }, + "name": "one", + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + }, + "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, }, - "range": Array [ - 53, - 54, - ], - "raw": "2", - "type": "Literal", - "value": 2, }, + "optional": false, "range": Array [ - 47, - 55, + 51, + 60, ], - "type": "OptionalMemberExpression", + "type": "OptionalCallExpression", }, "loc": Object { "end": Object { - "column": 11, + "column": 14, "line": 2, }, "start": Object { @@ -88451,29 +87702,19 @@ Object { }, }, "range": Array [ - 47, - 56, + 50, + 62, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "object": Object { - "computed": true, + "arguments": Array [], + "callee": Object { + "computed": false, "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 3, }, "start": Object { @@ -88482,78 +87723,105 @@ Object { }, }, "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 5, + "column": 11, "line": 3, }, "start": Object { - "column": 2, + "column": 3, "line": 3, }, }, - "name": "one", + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "one", + "range": Array [ + 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 [ - 59, - 62, + 66, + 74, ], - "type": "Identifier", + "type": "OptionalMemberExpression", }, - "optional": true, + "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 9, + "column": 15, "line": 3, }, "start": Object { - "column": 8, + "column": 13, "line": 3, }, }, + "name": "fn", "range": Array [ - 65, - 66, + 76, + 78, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ - 59, - 67, + 65, + 78, ], - "type": "OptionalMemberExpression", + "type": "MemberExpression", }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, }, - "range": Array [ - 68, - 69, - ], - "raw": "3", - "type": "Literal", - "value": 3, }, + "optional": false, "range": Array [ - 59, - 70, + 65, + 80, ], - "type": "OptionalMemberExpression", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 18, "line": 3, }, "start": Object { @@ -88562,109 +87830,126 @@ Object { }, }, "range": Array [ - 59, - 71, + 65, + 81, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, - "loc": Object { - "end": Object { - "column": 13, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "object": Object { - "computed": true, + "arguments": Array [], + "callee": Object { + "computed": false, "loc": Object { "end": Object { - "column": 8, + "column": 14, "line": 4, }, "start": Object { - "column": 2, + "column": 3, "line": 4, }, }, "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 4, }, "start": Object { - "column": 2, + "column": 3, "line": 4, }, }, - "name": "one", + "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 [ - 74, - 77, + 85, + 92, ], - "type": "Identifier", + "type": "MemberExpression", }, - "optional": false, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 7, + "column": 14, "line": 4, }, "start": Object { - "column": 6, + "column": 12, "line": 4, }, }, + "name": "fn", "range": Array [ - 78, - 79, - ], - "raw": "2", - "type": "Literal", - "value": 2, + 94, + 96, + ], + "type": "Identifier", }, "range": Array [ - 74, - 80, + 85, + 96, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 11, - "line": 4, - }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, }, - "range": Array [ - 83, - 84, - ], - "raw": "3", - "type": "Literal", - "value": 3, }, + "optional": false, "range": Array [ - 74, 85, + 98, ], - "type": "OptionalMemberExpression", + "type": "OptionalCallExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 18, "line": 4, }, "start": Object { @@ -88673,29 +87958,19 @@ Object { }, }, "range": Array [ - 74, - 86, + 84, + 100, ], "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, + "arguments": Array [], + "callee": Object { + "computed": false, "loc": Object { "end": Object { - "column": 8, + "column": 21, "line": 5, }, "start": Object { @@ -88704,78 +87979,142 @@ Object { }, }, "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 5, + "column": 17, "line": 5, }, "start": Object { - "column": 2, + "column": 3, "line": 5, }, }, - "name": "one", + "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 [ - 89, - 92, + 104, + 118, ], - "type": "Identifier", + "type": "OptionalMemberExpression", }, "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 7, + "column": 21, "line": 5, }, "start": Object { - "column": 6, + "column": 19, "line": 5, }, }, + "name": "fn", "range": Array [ - 93, - 94, + 120, + 122, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ - 89, - 95, + 103, + 122, ], "type": "MemberExpression", }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 5, - }, - "start": Object { - "column": 11, - "line": 5, - }, + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, }, - "range": Array [ - 98, - 99, - ], - "raw": "3", - "type": "Literal", - "value": 3, }, + "optional": false, "range": Array [ - 89, - 100, + 103, + 124, ], - "type": "OptionalMemberExpression", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 24, "line": 5, }, "start": Object { @@ -88784,147 +88123,163 @@ Object { }, }, "range": Array [ - 89, - 101, + 103, + 125, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, - "loc": Object { - "end": Object { - "column": 16, - "line": 6, - }, - "start": Object { - "column": 2, - "line": 6, - }, - }, - "object": Object { - "computed": true, + "arguments": Array [], + "callee": Object { + "computed": false, "loc": Object { "end": Object { - "column": 13, + "column": 21, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 8, + "column": 17, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, - "name": "one", - "range": Array [ - 104, - 107, - ], - "type": "Identifier", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 6, - }, - "start": Object { - "column": 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 [ - 108, - 109, + 138, + 143, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ - 104, - 110, + 129, + 143, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 12, + "column": 21, "line": 6, }, "start": Object { - "column": 11, + "column": 19, "line": 6, }, }, + "name": "fn", "range": Array [ - 113, - 114, + 145, + 147, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", }, "range": Array [ - 104, - 115, + 129, + 147, ], "type": "OptionalMemberExpression", }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 6, - }, - "start": Object { - "column": 14, - "line": 6, - }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, }, - "range": Array [ - 116, - 117, - ], - "raw": "4", - "type": "Literal", - "value": 4, }, + "optional": false, "range": Array [ - 104, - 118, + 129, + 149, ], - "type": "OptionalMemberExpression", + "type": "OptionalCallExpression", }, "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 6, }, "start": Object { @@ -88933,157 +88288,299 @@ Object { }, }, "range": Array [ - 104, - 119, + 128, + 151, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, - "loc": Object { - "end": Object { - "column": 18, - "line": 7, - }, - "start": Object { - "column": 2, - "line": 7, - }, - }, - "object": Object { - "computed": true, + "arguments": Array [], + "callee": Object { "loc": Object { "end": Object { - "column": 13, - "line": 7, + "column": 6, + "line": 8, }, "start": Object { - "column": 2, - "line": 7, + "column": 3, + "line": 8, }, }, - "object": Object { - "computed": true, + "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": 8, - "line": 7, + "column": 6, + "line": 9, }, "start": Object { - "column": 2, - "line": 7, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 7, - }, - "start": Object { - "column": 2, - "line": 7, - }, - }, - "name": "one", - "range": Array [ - 122, - 125, - ], - "type": "Identifier", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 7, - }, - "start": Object { - "column": 6, - "line": 7, - }, + "column": 3, + "line": 9, }, - "range": Array [ - 126, - 127, - ], - "raw": "2", - "type": "Literal", - "value": 2, }, + "name": "one", "range": Array [ - 122, - 128, + 169, + 172, ], - "type": "MemberExpression", + "type": "Identifier", }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 7, - }, - "start": Object { - "column": 11, - "line": 7, + "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 [ - 131, - 132, + 184, + 187, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, }, + "optional": true, "range": Array [ - 122, - 133, + 184, + 191, ], - "type": "OptionalMemberExpression", + "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": 6, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "name": "one", + "range": Array [ + 202, + 205, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "optional": true, + "range": Array [ + 202, + 209, + ], + "type": "OptionalCallExpression", + }, + "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 17, - "line": 7, + "column": 15, + "line": 12, }, "start": Object { - "column": 16, - "line": 7, + "column": 12, + "line": 12, }, }, + "name": "two", "range": Array [ - 136, - 137, + 211, + 214, ], - "raw": "4", - "type": "Literal", - "value": 4, + "type": "Identifier", }, "range": Array [ - 122, - 138, + 201, + 214, ], - "type": "OptionalMemberExpression", + "type": "MemberExpression", }, "loc": Object { "end": Object { - "column": 19, - "line": 7, + "column": 16, + "line": 12, }, "start": Object { "column": 2, - "line": 7, + "line": 12, }, }, "range": Array [ - 122, - 139, + 201, + 215, ], "type": "ExpressionStatement", }, @@ -89091,16 +88588,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 8, + "line": 13, }, "start": Object { - "column": 43, + "column": 46, "line": 1, }, }, "range": Array [ - 43, - 141, + 46, + 217, ], "type": "BlockStatement", }, @@ -89109,7 +88606,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 31, + "column": 34, "line": 1, }, "start": Object { @@ -89117,17 +88614,17 @@ Object { "line": 1, }, }, - "name": "processOptionalElement", + "name": "processOptionalCallParens", "range": Array [ 9, - 31, + 34, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 8, + "line": 13, }, "start": Object { "column": 0, @@ -89138,51 +88635,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 44, "line": 1, }, "start": Object { - "column": 32, + "column": 35, "line": 1, }, }, "name": "one", "optional": true, "range": Array [ - 32, - 41, + 35, + 44, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 44, "line": 1, }, "start": Object { - "column": 36, + "column": 39, "line": 1, }, }, "range": Array [ - 36, - 41, + 39, + 44, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 44, "line": 1, }, "start": Object { - "column": 38, + "column": 41, "line": 1, }, }, "range": Array [ - 38, 41, + 44, ], "type": "TSAnyKeyword", }, @@ -89191,7 +88688,7 @@ Object { ], "range": Array [ 0, - 141, + 217, ], "type": "FunctionDeclaration", }, @@ -89199,7 +88696,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 9, + "line": 14, }, "start": Object { "column": 0, @@ -89208,7 +88705,7 @@ Object { }, "range": Array [ 0, - 142, + 218, ], "sourceType": "script", "tokens": Array [ @@ -89233,7 +88730,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 34, "line": 1, }, "start": Object { @@ -89243,25 +88740,25 @@ Object { }, "range": Array [ 9, - 31, + 34, ], "type": "Identifier", - "value": "processOptionalElement", + "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": "(", @@ -89269,17 +88766,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 38, "line": 1, }, "start": Object { - "column": 32, + "column": 35, "line": 1, }, }, "range": Array [ - 32, 35, + 38, ], "type": "Identifier", "value": "one", @@ -89287,17 +88784,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, + "column": 39, "line": 1, }, "start": Object { - "column": 35, + "column": 38, "line": 1, }, }, "range": Array [ - 35, - 36, + 38, + 39, ], "type": "Punctuator", "value": "?", @@ -89305,17 +88802,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, + "column": 40, "line": 1, }, "start": Object { - "column": 36, + "column": 39, "line": 1, }, }, "range": Array [ - 36, - 37, + 39, + 40, ], "type": "Punctuator", "value": ":", @@ -89323,17 +88820,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 44, "line": 1, }, "start": Object { - "column": 38, + "column": 41, "line": 1, }, }, "range": Array [ - 38, 41, + 44, ], "type": "Identifier", "value": "any", @@ -89341,17 +88838,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 45, "line": 1, }, "start": Object { - "column": 41, + "column": 44, "line": 1, }, }, "range": Array [ - 41, - 42, + 44, + 45, ], "type": "Punctuator", "value": ")", @@ -89359,17 +88856,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 44, + "column": 47, "line": 1, }, "start": Object { - "column": 43, + "column": 46, "line": 1, }, }, "range": Array [ - 43, - 44, + 46, + 47, ], "type": "Punctuator", "value": "{", @@ -89377,7 +88874,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 2, }, "start": Object { @@ -89386,29 +88883,29 @@ Object { }, }, "range": Array [ - 47, 50, + 51, ], - "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 [ - 50, - 52, + 51, + 54, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { @@ -89417,21 +88914,21 @@ Object { "line": 2, }, "start": Object { - "column": 7, + "column": 6, "line": 2, }, }, "range": Array [ - 52, - 53, + 54, + 56, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 10, "line": 2, }, "start": Object { @@ -89440,137 +88937,137 @@ Object { }, }, "range": Array [ - 53, - 54, + 56, + 58, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 2, }, "start": Object { - "column": 9, + "column": 10, "line": 2, }, }, "range": Array [ - 54, - 55, + 58, + 59, ], "type": "Punctuator", - "value": "]", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 2, }, "start": Object { - "column": 10, + "column": 11, "line": 2, }, }, "range": Array [ - 55, - 56, + 59, + 60, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 13, + "line": 2, }, "start": Object { - "column": 2, - "line": 3, + "column": 12, + "line": 2, }, }, "range": Array [ - 59, - 62, + 60, + 61, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 14, + "line": 2, }, "start": Object { - "column": 5, - "line": 3, + "column": 13, + "line": 2, }, }, "range": Array [ + 61, 62, - 64, ], "type": "Punctuator", - "value": "?.", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 3, "line": 3, }, "start": Object { - "column": 7, + "column": 2, "line": 3, }, }, "range": Array [ - 64, 65, + 66, ], "type": "Punctuator", - "value": "[", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 3, }, "start": Object { - "column": 8, + "column": 3, "line": 3, }, }, "range": Array [ - 65, 66, + 69, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 3, }, "start": Object { - "column": 9, + "column": 6, "line": 3, }, }, "range": Array [ - 66, - 67, + 69, + 71, ], "type": "Punctuator", - "value": "]", + "value": "?.", }, Object { "loc": Object { @@ -89579,16 +89076,16 @@ Object { "line": 3, }, "start": Object { - "column": 10, + "column": 8, "line": 3, }, }, "range": Array [ - 67, - 68, + 71, + 74, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { @@ -89602,11 +89099,11 @@ Object { }, }, "range": Array [ - 68, - 69, + 74, + 75, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -89620,16 +89117,16 @@ Object { }, }, "range": Array [ - 69, - 70, + 75, + 76, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 3, }, "start": Object { @@ -89638,155 +89135,155 @@ Object { }, }, "range": Array [ - 70, - 71, + 76, + 78, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 16, + "line": 3, }, "start": Object { - "column": 2, - "line": 4, + "column": 15, + "line": 3, }, }, "range": Array [ - 74, - 77, + 78, + 79, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 4, + "column": 17, + "line": 3, }, "start": Object { - "column": 5, - "line": 4, + "column": 16, + "line": 3, }, }, "range": Array [ - 77, - 78, + 79, + 80, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 18, + "line": 3, }, "start": Object { - "column": 6, - "line": 4, + "column": 17, + "line": 3, }, }, "range": Array [ - 78, - 79, + 80, + 81, ], - "type": "Numeric", - "value": "2", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 3, "line": 4, }, "start": Object { - "column": 7, + "column": 2, "line": 4, }, }, "range": Array [ - 79, - 80, + 84, + 85, ], "type": "Punctuator", - "value": "]", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 6, "line": 4, }, "start": Object { - "column": 8, + "column": 3, "line": 4, }, }, "range": Array [ - 80, - 82, + 85, + 88, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 7, "line": 4, }, "start": Object { - "column": 10, + "column": 6, "line": 4, }, }, "range": Array [ - 82, - 83, + 88, + 89, ], "type": "Punctuator", - "value": "[", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 10, "line": 4, }, "start": Object { - "column": 11, + "column": 7, "line": 4, }, }, "range": Array [ - 83, - 84, + 89, + 92, ], - "type": "Numeric", - "value": "3", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 4, }, "start": Object { - "column": 12, + "column": 10, "line": 4, }, }, "range": Array [ - 84, - 85, + 92, + 94, ], "type": "Punctuator", - "value": "]", + "value": "?.", }, Object { "loc": Object { @@ -89795,884 +89292,5612 @@ Object { "line": 4, }, "start": Object { - "column": 13, + "column": 12, "line": 4, }, }, "range": Array [ - 85, - 86, + 94, + 96, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 15, + "line": 4, }, "start": Object { - "column": 2, - "line": 5, + "column": 14, + "line": 4, }, }, "range": Array [ - 89, - 92, + 96, + 97, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 5, + "column": 16, + "line": 4, }, "start": Object { - "column": 5, - "line": 5, + "column": 15, + "line": 4, }, }, "range": Array [ - 92, - 93, + 97, + 98, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 17, + "line": 4, }, "start": Object { - "column": 6, - "line": 5, + "column": 16, + "line": 4, }, }, "range": Array [ - 93, - 94, + 98, + 99, ], - "type": "Numeric", - "value": "2", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 5, + "column": 18, + "line": 4, }, "start": Object { - "column": 7, - "line": 5, + "column": 17, + "line": 4, }, }, "range": Array [ - 94, - 95, + 99, + 100, ], "type": "Punctuator", - "value": "]", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 3, "line": 5, }, "start": Object { - "column": 8, + "column": 2, "line": 5, }, }, "range": Array [ - 95, - 97, + 103, + 104, ], "type": "Punctuator", - "value": "?.", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 6, "line": 5, }, "start": Object { - "column": 10, + "column": 3, "line": 5, }, }, "range": Array [ - 97, - 98, + 104, + 107, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 7, "line": 5, }, "start": Object { - "column": 11, + "column": 6, "line": 5, }, }, "range": Array [ - 98, - 99, + 107, + 108, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 5, }, "start": Object { - "column": 12, + "column": 7, "line": 5, }, }, "range": Array [ - 99, - 100, + 108, + 111, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 12, "line": 5, }, "start": Object { - "column": 13, + "column": 10, "line": 5, }, }, "range": Array [ - 100, - 101, + 111, + 113, ], "type": "Punctuator", - "value": ";", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 17, + "line": 5, }, "start": Object { - "column": 2, - "line": 6, + "column": 12, + "line": 5, }, }, "range": Array [ - 104, - 107, + 113, + 118, ], "type": "Identifier", - "value": "one", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 6, + "column": 18, + "line": 5, }, "start": Object { - "column": 5, - "line": 6, + "column": 17, + "line": 5, }, }, "range": Array [ - 107, - 108, + 118, + 119, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 6, + "column": 19, + "line": 5, }, "start": Object { - "column": 6, - "line": 6, + "column": 18, + "line": 5, }, }, "range": Array [ - 108, - 109, + 119, + 120, ], - "type": "Numeric", - "value": "2", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 6, + "column": 21, + "line": 5, }, "start": Object { - "column": 7, - "line": 6, + "column": 19, + "line": 5, }, }, "range": Array [ - 109, - 110, + 120, + 122, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 6, + "column": 22, + "line": 5, }, "start": Object { - "column": 8, - "line": 6, + "column": 21, + "line": 5, }, }, "range": Array [ - 110, - 112, + 122, + 123, ], "type": "Punctuator", - "value": "?.", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 6, + "column": 23, + "line": 5, }, "start": Object { - "column": 10, - "line": 6, + "column": 22, + "line": 5, }, }, "range": Array [ - 112, - 113, + 123, + 124, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 24, + "line": 5, }, "start": Object { - "column": 11, - "line": 6, + "column": 23, + "line": 5, }, }, "range": Array [ - 113, - 114, + 124, + 125, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 3, "line": 6, }, "start": Object { - "column": 12, + "column": 2, "line": 6, }, }, "range": Array [ - 114, - 115, + 128, + 129, ], "type": "Punctuator", - "value": "]", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 6, "line": 6, }, "start": Object { - "column": 13, + "column": 3, "line": 6, }, }, "range": Array [ - 115, - 116, + 129, + 132, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 6, }, "start": Object { - "column": 14, + "column": 6, "line": 6, }, }, "range": Array [ - 116, - 117, + 132, + 133, ], - "type": "Numeric", - "value": "4", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 6, }, "start": Object { - "column": 15, + "column": 7, "line": 6, }, }, "range": Array [ - 117, - 118, + 133, + 136, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 12, "line": 6, }, "start": Object { - "column": 16, + "column": 10, "line": 6, }, }, "range": Array [ - 118, - 119, + 136, + 138, ], "type": "Punctuator", - "value": ";", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 7, + "column": 17, + "line": 6, }, "start": Object { - "column": 2, - "line": 7, + "column": 12, + "line": 6, }, }, "range": Array [ - 122, - 125, + 138, + 143, ], "type": "Identifier", - "value": "one", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 7, + "column": 19, + "line": 6, }, "start": Object { - "column": 5, - "line": 7, + "column": 17, + "line": 6, }, }, "range": Array [ - 125, - 126, + 143, + 145, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 7, + "column": 21, + "line": 6, }, "start": Object { - "column": 6, - "line": 7, + "column": 19, + "line": 6, }, }, "range": Array [ - 126, - 127, + 145, + 147, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 7, + "column": 22, + "line": 6, }, "start": Object { - "column": 7, - "line": 7, + "column": 21, + "line": 6, }, }, "range": Array [ - 127, - 128, + 147, + 148, ], "type": "Punctuator", - "value": "]", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 7, + "column": 23, + "line": 6, }, "start": Object { - "column": 8, - "line": 7, + "column": 22, + "line": 6, }, }, "range": Array [ - 128, - 130, + 148, + 149, ], "type": "Punctuator", - "value": "?.", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 7, + "column": 24, + "line": 6, }, "start": Object { - "column": 10, - "line": 7, + "column": 23, + "line": 6, }, }, "range": Array [ - 130, - 131, + 149, + 150, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 7, + "column": 25, + "line": 6, }, "start": Object { - "column": 11, - "line": 7, + "column": 24, + "line": 6, }, }, "range": Array [ - 131, - 132, + 150, + 151, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 7, + "column": 3, + "line": 8, }, "start": Object { - "column": 12, - "line": 7, + "column": 2, + "line": 8, }, }, "range": Array [ - 132, - 133, + 155, + 156, ], "type": "Punctuator", - "value": "]", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 7, + "column": 6, + "line": 8, }, "start": Object { - "column": 13, - "line": 7, + "column": 3, + "line": 8, }, }, "range": Array [ - 133, - 135, + 156, + 159, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 7, + "column": 8, + "line": 8, }, "start": Object { - "column": 15, - "line": 7, + "column": 6, + "line": 8, }, }, "range": Array [ - 135, - 136, + 159, + 161, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 7, + "column": 9, + "line": 8, }, "start": Object { - "column": 16, - "line": 7, + "column": 8, + "line": 8, }, }, "range": Array [ - 136, - 137, + 161, + 162, ], - "type": "Numeric", - "value": "4", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 7, + "column": 10, + "line": 8, }, "start": Object { - "column": 17, - "line": 7, + "column": 9, + "line": 8, }, }, "range": Array [ - 137, - 138, + 162, + 163, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 7, + "column": 11, + "line": 8, }, "start": Object { - "column": 18, - "line": 7, + "column": 10, + "line": 8, }, }, "range": Array [ - 138, - 139, + 163, + 164, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 12, "line": 8, }, "start": Object { - "column": 0, + "column": 11, "line": 8, }, }, "range": Array [ - 140, - 141, + 164, + 165, ], "type": "Punctuator", - "value": "}", + "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/optional-chain-element-access-with-parens.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "computed": true, - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 3, - "line": 2, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 2, - }, - "start": Object { - "column": 3, - "line": 2, - }, - }, - "name": "one", - "range": Array [ - 54, - 57, - ], - "type": "Identifier", - }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 60, - 61, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "range": Array [ - 54, - 62, - ], - "type": "OptionalMemberExpression", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 53, - 64, - ], - "type": "ExpressionStatement", - }, - Object { - "expression": Object { - "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": 11, - "line": 3, - }, - "start": Object { - "column": 3, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 3, - }, - "start": Object { - "column": 3, - "line": 3, - }, - }, - "name": "one", - "range": Array [ - 68, - 71, - ], - "type": "Identifier", - }, - "optional": true, - "property": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "range": Array [ - 74, - 75, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "range": Array [ - 68, - 76, - ], - "type": "OptionalMemberExpression", - }, - "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, - }, - "range": Array [ - 67, - 80, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 67, - 81, - ], - "type": "ExpressionStatement", - }, - Object { - "expression": Object { - "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": 9, - "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, - ], + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 169, + 172, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 172, + 174, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 174, + 175, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "range": Array [ + 175, + 176, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 10, + "line": 9, + }, + }, + "range": Array [ + 176, + 177, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 177, + 178, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 183, + 184, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "range": Array [ + 184, + 187, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 10, + }, + }, + "range": Array [ + 187, + 189, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 189, + 190, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 9, + "line": 10, + }, + }, + "range": Array [ + 190, + 191, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 10, + }, + "start": Object { + "column": 10, + "line": 10, + }, + }, + "range": Array [ + 191, + 192, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 11, + "line": 10, + }, + }, + "range": Array [ + 192, + 194, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 10, + }, + }, + "range": Array [ + 194, + 195, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 15, + "line": 10, + }, + }, + "range": Array [ + 196, + 197, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 201, + 202, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "range": Array [ + 202, + 205, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 12, + }, + "start": Object { + "column": 6, + "line": 12, + }, + }, + "range": Array [ + 205, + 207, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 207, + 208, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "range": Array [ + 208, + 209, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 12, + }, + "start": Object { + "column": 10, + "line": 12, + }, + }, + "range": Array [ + 209, + 210, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 12, + }, + "start": Object { + "column": 11, + "line": 12, + }, + }, + "range": Array [ + 210, + 211, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 12, + "line": 12, + }, + }, + "range": Array [ + 211, + 214, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 12, + }, + }, + "range": Array [ + 214, + 215, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 13, + }, + }, + "range": Array [ + 216, + 217, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "computed": true, + "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 [ + 47, + 50, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 47, + 55, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 47, + 56, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "computed": true, + "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 [ + 59, + 62, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 59, + 67, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 59, + 70, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 71, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "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": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "one", + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 93, + 94, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 89, + 95, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 99, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 89, + 100, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 89, + 101, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "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 [ + 104, + 107, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 108, + 109, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 104, + 110, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 113, + 114, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 104, + 115, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 116, + 117, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 104, + 118, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 104, + 119, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "name": "one", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 126, + 127, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 122, + 128, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 122, + 133, + ], + "type": "OptionalMemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 122, + 138, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 122, + 139, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 141, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalElement", + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 32, + 41, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 141, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 142, + ], + "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": "processOptionalElement", + }, + 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": 35, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "one", + }, + 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": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "Identifier", + "value": "any", + }, + 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": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 50, + 52, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "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 { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "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, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "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 { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 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": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 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": "?.", + }, + Object { + "loc": Object { + "end": Object { + "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 { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 84, + 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 { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 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": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 95, + 97, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "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": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "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, + ], + "type": "Punctuator", + "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": 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 [ + 135, + 136, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/optional-chain-element-access-with-non-null-assertion.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 14, + "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": 13, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 46, + 51, + ], + "raw": "'two'", + "type": "Literal", + "value": "two", + }, + "range": Array [ + 40, + 52, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 53, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "three", + "range": Array [ + 54, + 59, + ], + "type": "Identifier", + }, + "range": Array [ + 40, + 59, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 60, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "one", + "range": Array [ + 64, + 67, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 70, + 75, + ], + "raw": "'two'", + "type": "Literal", + "value": "two", + }, + "range": Array [ + 64, + 76, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 63, + 78, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "name": "three", + "range": Array [ + 79, + 84, + ], + "type": "Identifier", + }, + "range": Array [ + 63, + 84, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 63, + 85, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 15, + "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 [ + 89, + 92, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 95, + 100, + ], + "raw": "'two'", + "type": "Literal", + "value": "two", + }, + "range": Array [ + 89, + 101, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 89, + 102, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": "three", + "range": Array [ + 104, + 109, + ], + "type": "Identifier", + }, + "range": Array [ + 88, + 109, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 88, + 110, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "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 [ + 113, + 116, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "name": "two", + "range": Array [ + 118, + 121, + ], + "type": "Identifier", + }, + "range": Array [ + 113, + 121, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 113, + 122, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 123, + 130, + ], + "raw": "'three'", + "type": "Literal", + "value": "three", + }, + "range": Array [ + 113, + 131, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 113, + 132, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "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 [ + 136, + 139, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "two", + "range": Array [ + 141, + 144, + ], + "type": "Identifier", + }, + "range": Array [ + 136, + 144, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 135, + 146, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 147, + 154, + ], + "raw": "'three'", + "type": "Literal", + "value": "three", + }, + "range": Array [ + 135, + 155, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 135, + 156, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "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 [ + 160, + 163, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": "two", + "range": Array [ + 165, + 168, + ], + "type": "Identifier", + }, + "range": Array [ + 160, + 168, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 160, + 169, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 171, + 178, + ], + "raw": "'three'", + "type": "Literal", + "value": "three", + }, + "range": Array [ + 159, + 179, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 159, + 180, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 182, + ], + "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": 8, + }, + "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, + 182, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 183, + ], + "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": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 46, + 51, + ], + "type": "String", + "value": "'two'", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 54, + 59, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 64, + 67, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 67, + 69, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "String", + "value": "'two'", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 79, + 84, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 92, + 94, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 95, + 100, + ], + "type": "String", + "value": "'two'", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 104, + 109, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 113, + 116, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 116, + 118, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 118, + 121, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 123, + 130, + ], + "type": "String", + "value": "'three'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 136, + 139, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 139, + 141, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 141, + 144, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 144, + 145, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 147, + 154, + ], + "type": "String", + "value": "'three'", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 21, + "line": 6, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 22, + "line": 6, + }, + }, + "range": Array [ + 155, + 156, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 160, + 163, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 163, + 165, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 165, + 168, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 169, + 170, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 170, + 171, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 171, + 178, + ], + "type": "String", + "value": "'three'", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 21, + "line": 7, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 22, + "line": 7, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 181, + 182, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/optional-chain-element-access-with-parens.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "one", + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 60, + 61, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 54, + 62, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 64, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "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": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "one", + "range": Array [ + 68, + 71, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 68, + 76, + ], + "type": "OptionalMemberExpression", + }, + "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, + }, + "range": Array [ + 67, + 80, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 67, + 81, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "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": 9, + "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, @@ -91222,187 +95447,853 @@ Object { "line": 7, }, }, - "range": Array [ - 143, - 165, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 8, - }, - "start": Object { - "column": 49, - "line": 1, + "range": Array [ + 143, + 165, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 167, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalElementParens", + "range": Array [ + 9, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 38, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "TSAnyKeyword", + }, }, }, - "range": Array [ - 49, - 167, - ], - "type": "BlockStatement", + ], + "range": Array [ + 0, + 167, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 168, + ], + "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": 37, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 37, + ], + "type": "Identifier", + "value": "processOptionalElementParens", + }, + 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": 41, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "Identifier", + "value": "one", + }, + 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": 47, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 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", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 57, + 59, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 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": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 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", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 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 { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "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 { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, }, - "name": "processOptionalElementParens", - "range": Array [ - 9, - 37, - ], - "type": "Identifier", }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ";", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 8, + "column": 3, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 4, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "name": "one", - "optional": true, - "range": Array [ - 38, - 47, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 42, - "line": 1, - }, - }, - "range": Array [ - 42, - 47, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 44, - "line": 1, - }, - }, - "range": Array [ - 44, - 47, - ], - "type": "TSAnyKeyword", - }, - }, + "range": Array [ + 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", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "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 { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 91, + 93, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 93, + 94, + ], + "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 { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, }, - ], + }, "range": Array [ - 0, - 167, + 95, + 96, ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 9, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "]", }, - }, - "range": Array [ - 0, - 168, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 15, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 14, + "line": 4, }, }, "range": Array [ - 0, - 8, + 96, + 97, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 16, + "line": 4, }, "start": Object { - "column": 9, - "line": 1, + "column": 15, + "line": 4, }, }, "range": Array [ - 9, - 37, + 97, + 98, ], - "type": "Identifier", - "value": "processOptionalElementParens", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { - "column": 37, - "line": 1, + "column": 2, + "line": 5, }, }, "range": Array [ - 37, - 38, + 101, + 102, ], "type": "Punctuator", "value": "(", @@ -91410,17 +96301,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 6, + "line": 5, }, "start": Object { - "column": 38, - "line": 1, + "column": 3, + "line": 5, }, }, "range": Array [ - 38, - 41, + 102, + 105, ], "type": "Identifier", "value": "one", @@ -91428,161 +96319,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 7, + "line": 5, }, "start": Object { - "column": 41, - "line": 1, + "column": 6, + "line": 5, }, }, "range": Array [ - 41, - 42, + 105, + 106, ], "type": "Punctuator", - "value": "?", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 8, + "line": 5, }, "start": Object { - "column": 42, - "line": 1, + "column": 7, + "line": 5, }, }, "range": Array [ - 42, - 43, + 106, + 107, ], - "type": "Punctuator", - "value": ":", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 44, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 44, - 47, + 107, + 108, ], - "type": "Identifier", - "value": "any", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 11, + "line": 5, }, "start": Object { - "column": 47, - "line": 1, + "column": 9, + "line": 5, }, }, "range": Array [ - 47, - 48, + 108, + 110, ], "type": "Punctuator", - "value": ")", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 50, - "line": 1, + "column": 12, + "line": 5, }, "start": Object { - "column": 49, - "line": 1, + "column": 11, + "line": 5, }, }, "range": Array [ - 49, - 50, + 110, + 111, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 13, + "line": 5, }, "start": Object { - "column": 2, - "line": 2, + "column": 12, + "line": 5, }, }, "range": Array [ - 53, - 54, + 111, + 112, ], - "type": "Punctuator", - "value": "(", + "type": "Numeric", + "value": "3", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 14, + "line": 5, }, "start": Object { - "column": 3, - "line": 2, + "column": 13, + "line": 5, }, }, "range": Array [ - 54, - 57, + 112, + 113, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 15, + "line": 5, }, "start": Object { - "column": 6, - "line": 2, + "column": 14, + "line": 5, }, }, "range": Array [ - 57, - 59, + 113, + 114, ], "type": "Punctuator", - "value": "?.", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 16, + "line": 5, }, "start": Object { - "column": 8, - "line": 2, + "column": 15, + "line": 5, }, }, "range": Array [ - 59, - 60, + 114, + 115, ], "type": "Punctuator", "value": "[", @@ -91590,125 +96481,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 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": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, }, "start": Object { - "column": 9, - "line": 2, + "column": 18, + "line": 5, }, }, "range": Array [ - 60, - 61, + 117, + 118, ], - "type": "Numeric", - "value": "2", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 3, + "line": 6, }, "start": Object { - "column": 10, - "line": 2, + "column": 2, + "line": 6, }, }, "range": Array [ - 61, - 62, + 121, + 122, ], "type": "Punctuator", - "value": "]", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 6, + "line": 6, }, "start": Object { - "column": 11, - "line": 2, + "column": 3, + "line": 6, }, }, "range": Array [ - 62, - 63, + 122, + 125, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 7, + "line": 6, }, "start": Object { - "column": 12, - "line": 2, + "column": 6, + "line": 6, }, }, "range": Array [ - 63, - 64, + 125, + 126, ], "type": "Punctuator", - "value": ";", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 3, + "column": 8, + "line": 6, }, "start": Object { - "column": 2, - "line": 3, + "column": 7, + "line": 6, }, }, "range": Array [ - 67, - 68, + 126, + 127, ], - "type": "Punctuator", - "value": "(", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 9, + "line": 6, }, "start": Object { - "column": 3, - "line": 3, + "column": 8, + "line": 6, }, }, "range": Array [ - 68, - 71, + 127, + 128, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 11, + "line": 6, }, "start": Object { - "column": 6, - "line": 3, + "column": 9, + "line": 6, }, }, "range": Array [ - 71, - 73, + 128, + 130, ], "type": "Punctuator", "value": "?.", @@ -91716,17 +96643,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 12, + "line": 6, }, "start": Object { - "column": 8, - "line": 3, + "column": 11, + "line": 6, }, }, "range": Array [ - 73, - 74, + 130, + 131, ], "type": "Punctuator", "value": "[", @@ -91734,35 +96661,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 13, + "line": 6, }, "start": Object { - "column": 9, - "line": 3, + "column": 12, + "line": 6, }, }, "range": Array [ - 74, - 75, + 131, + 132, ], "type": "Numeric", - "value": "2", + "value": "3", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, + "column": 14, + "line": 6, }, "start": Object { - "column": 10, - "line": 3, + "column": 13, + "line": 6, }, }, "range": Array [ - 75, - 76, + 132, + 133, ], "type": "Punctuator", "value": "]", @@ -91770,35 +96697,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 16, + "line": 6, }, "start": Object { - "column": 11, - "line": 3, + "column": 14, + "line": 6, }, }, "range": Array [ - 76, - 77, + 133, + 135, ], "type": "Punctuator", - "value": ")", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 17, + "line": 6, }, "start": Object { - "column": 12, - "line": 3, + "column": 16, + "line": 6, }, }, "range": Array [ - 77, - 78, + 135, + 136, ], "type": "Punctuator", "value": "[", @@ -91806,35 +96733,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 18, + "line": 6, }, "start": Object { - "column": 13, - "line": 3, + "column": 17, + "line": 6, }, }, "range": Array [ - 78, - 79, + 136, + 137, ], "type": "Numeric", - "value": "3", + "value": "4", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 19, + "line": 6, }, "start": Object { - "column": 14, - "line": 3, + "column": 18, + "line": 6, }, }, "range": Array [ - 79, - 80, + 137, + 138, ], "type": "Punctuator", "value": "]", @@ -91842,17 +96769,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 20, + "line": 6, }, "start": Object { - "column": 15, - "line": 3, + "column": 19, + "line": 6, }, }, "range": Array [ - 80, - 81, + 138, + 139, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 20, + "line": 6, + }, + }, + "range": Array [ + 139, + 140, ], "type": "Punctuator", "value": ";", @@ -91861,16 +96806,16 @@ Object { "loc": Object { "end": Object { "column": 3, - "line": 4, + "line": 7, }, "start": Object { "column": 2, - "line": 4, + "line": 7, }, }, "range": Array [ - 84, - 85, + 143, + 144, ], "type": "Punctuator", "value": "(", @@ -91879,16 +96824,16 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 4, + "line": 7, }, "start": Object { "column": 3, - "line": 4, + "line": 7, }, }, "range": Array [ - 85, - 88, + 144, + 147, ], "type": "Identifier", "value": "one", @@ -91897,16 +96842,16 @@ Object { "loc": Object { "end": Object { "column": 7, - "line": 4, + "line": 7, }, "start": Object { "column": 6, - "line": 4, + "line": 7, }, }, "range": Array [ - 88, - 89, + 147, + 148, ], "type": "Punctuator", "value": "[", @@ -91915,16 +96860,16 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 4, + "line": 7, }, "start": Object { "column": 7, - "line": 4, + "line": 7, }, }, "range": Array [ - 89, - 90, + 148, + 149, ], "type": "Numeric", "value": "2", @@ -91933,16 +96878,16 @@ Object { "loc": Object { "end": Object { "column": 9, - "line": 4, + "line": 7, }, "start": Object { "column": 8, - "line": 4, + "line": 7, }, }, "range": Array [ - 90, - 91, + 149, + 150, ], "type": "Punctuator", "value": "]", @@ -91951,16 +96896,16 @@ Object { "loc": Object { "end": Object { "column": 11, - "line": 4, + "line": 7, }, "start": Object { "column": 9, - "line": 4, + "line": 7, }, }, "range": Array [ - 91, - 93, + 150, + 152, ], "type": "Punctuator", "value": "?.", @@ -91969,16 +96914,16 @@ Object { "loc": Object { "end": Object { "column": 12, - "line": 4, + "line": 7, }, "start": Object { "column": 11, - "line": 4, + "line": 7, }, }, "range": Array [ - 93, - 94, + 152, + 153, ], "type": "Punctuator", "value": "[", @@ -91987,16 +96932,16 @@ Object { "loc": Object { "end": Object { "column": 13, - "line": 4, + "line": 7, }, "start": Object { "column": 12, - "line": 4, + "line": 7, }, }, "range": Array [ - 94, - 95, + 153, + 154, ], "type": "Numeric", "value": "3", @@ -92005,16 +96950,16 @@ Object { "loc": Object { "end": Object { "column": 14, - "line": 4, + "line": 7, }, "start": Object { "column": 13, - "line": 4, + "line": 7, }, }, "range": Array [ - 95, - 96, + 154, + 155, ], "type": "Punctuator", "value": "]", @@ -92022,89 +96967,107 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 4, + "column": 16, + "line": 7, }, "start": Object { "column": 14, - "line": 4, + "line": 7, }, }, "range": Array [ - 96, - 97, + 155, + 157, ], "type": "Punctuator", - "value": ")", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 17, + "line": 7, }, "start": Object { - "column": 15, - "line": 4, + "column": 16, + "line": 7, }, }, "range": Array [ - 97, - 98, + 157, + 158, ], "type": "Punctuator", - "value": ";", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 18, + "line": 7, }, "start": Object { - "column": 2, - "line": 5, + "column": 17, + "line": 7, }, }, "range": Array [ - 101, - 102, + 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": 6, - "line": 5, + "column": 20, + "line": 7, }, "start": Object { - "column": 3, - "line": 5, + "column": 19, + "line": 7, }, }, "range": Array [ - 102, - 105, + 160, + 161, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 21, + "line": 7, }, "start": Object { - "column": 6, - "line": 5, + "column": 20, + "line": 7, }, }, "range": Array [ - 105, - 106, + 161, + 162, ], "type": "Punctuator", "value": "[", @@ -92112,35 +97075,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, - "line": 5, + "column": 22, + "line": 7, }, "start": Object { - "column": 7, - "line": 5, + "column": 21, + "line": 7, }, }, "range": Array [ - 106, - 107, + 162, + 163, ], "type": "Numeric", - "value": "2", + "value": "5", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 23, + "line": 7, }, "start": Object { - "column": 8, - "line": 5, + "column": 22, + "line": 7, }, }, "range": Array [ - 107, - 108, + 163, + 164, ], "type": "Punctuator", "value": "]", @@ -92148,179 +97111,604 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 5, + "column": 24, + "line": 7, }, "start": Object { - "column": 9, - "line": 5, + "column": 23, + "line": 7, + }, + }, + "range": Array [ + 164, + 165, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/optional-chain-with-non-null-assertion.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": 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": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "three", + "range": Array [ + 50, + 55, + ], + "type": "Identifier", + }, + "range": Array [ + 40, + 55, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 56, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "one", + "range": Array [ + 60, + 63, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "two", + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + }, + "range": Array [ + 60, + 68, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 70, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "three", + "range": Array [ + 71, + 76, + ], + "type": "Identifier", + }, + "range": Array [ + 59, + 76, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 77, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "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 [ + 81, + 84, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": "two", + "range": Array [ + 86, + 89, + ], + "type": "Identifier", + }, + "range": Array [ + 81, + 89, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 81, + 90, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "name": "three", + "range": Array [ + 92, + 97, + ], + "type": "Identifier", + }, + "range": Array [ + 80, + 97, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 80, + 98, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 36, + "line": 1, + }, }, + "range": Array [ + 36, + 100, + ], + "type": "BlockStatement", }, - "range": Array [ - 108, - 110, - ], - "type": "Punctuator", - "value": "?.", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 5, - }, - "start": Object { - "column": 11, - "line": 5, + "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", }, - "range": Array [ - 110, - 111, - ], - "type": "Punctuator", - "value": "[", - }, - Object { "loc": Object { "end": Object { - "column": 13, + "column": 1, "line": 5, }, "start": Object { - "column": 12, - "line": 5, + "column": 0, + "line": 1, }, }, - "range": Array [ - 111, - 112, - ], - "type": "Numeric", - "value": "3", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 5, - }, - "start": Object { - "column": 13, - "line": 5, + "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 [ - 112, - 113, ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, "range": Array [ - 113, - 114, + 0, + 100, ], - "type": "Punctuator", - "value": ")", + "type": "FunctionDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 5, - }, - "start": Object { - "column": 15, - "line": 5, - }, - }, - "range": Array [ - 114, - 115, - ], - "type": "Punctuator", - "value": "[", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 16, - "line": 5, - }, - }, - "range": Array [ - 115, - 116, - ], - "type": "Numeric", - "value": "4", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 101, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 18, - "line": 5, + "column": 8, + "line": 1, }, "start": Object { - "column": 17, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 116, - 117, + 0, + 8, ], - "type": "Punctuator", - "value": "]", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 5, + "column": 24, + "line": 1, }, "start": Object { - "column": 18, - "line": 5, + "column": 9, + "line": 1, }, }, "range": Array [ - 117, - 118, + 9, + 24, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "processOptional", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 6, + "column": 25, + "line": 1, }, "start": Object { - "column": 2, - "line": 6, + "column": 24, + "line": 1, }, }, "range": Array [ - 121, - 122, + 24, + 25, ], "type": "Punctuator", "value": "(", @@ -92328,17 +97716,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, - "line": 6, + "column": 28, + "line": 1, }, "start": Object { - "column": 3, - "line": 6, + "column": 25, + "line": 1, }, }, "range": Array [ - 122, - 125, + 25, + 28, ], "type": "Identifier", "value": "one", @@ -92346,143 +97734,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, - "line": 6, + "column": 29, + "line": 1, }, "start": Object { - "column": 6, - "line": 6, + "column": 28, + "line": 1, }, }, "range": Array [ - 125, - 126, + 28, + 29, ], "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 6, - }, - "start": Object { - "column": 7, - "line": 6, - }, - }, - "range": Array [ - 126, - 127, - ], - "type": "Numeric", - "value": "2", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 6, + "column": 30, + "line": 1, }, "start": Object { - "column": 8, - "line": 6, + "column": 29, + "line": 1, }, }, "range": Array [ - 127, - 128, + 29, + 30, ], "type": "Punctuator", - "value": "]", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 6, + "column": 34, + "line": 1, }, "start": Object { - "column": 9, - "line": 6, + "column": 31, + "line": 1, }, }, "range": Array [ - 128, - 130, + 31, + 34, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 35, + "line": 1, }, "start": Object { - "column": 11, - "line": 6, + "column": 34, + "line": 1, }, }, "range": Array [ - 130, - 131, + 34, + 35, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 6, + "column": 37, + "line": 1, }, "start": Object { - "column": 12, - "line": 6, + "column": 36, + "line": 1, }, }, "range": Array [ - 131, - 132, + 36, + 37, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 6, + "column": 5, + "line": 2, }, "start": Object { - "column": 13, - "line": 6, + "column": 2, + "line": 2, }, }, "range": Array [ - 132, - 133, + 40, + 43, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 6, + "column": 7, + "line": 2, }, "start": Object { - "column": 14, - "line": 6, + "column": 5, + "line": 2, }, }, "range": Array [ - 133, - 135, + 43, + 45, ], "type": "Punctuator", "value": "?.", @@ -92490,89 +97860,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, - "line": 6, + "column": 10, + "line": 2, }, "start": Object { - "column": 16, - "line": 6, + "column": 7, + "line": 2, }, }, "range": Array [ - 135, - 136, + 45, + 48, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 6, + "column": 11, + "line": 2, }, "start": Object { - "column": 17, - "line": 6, + "column": 10, + "line": 2, }, }, "range": Array [ - 136, - 137, + 48, + 49, ], - "type": "Numeric", - "value": "4", + "type": "Punctuator", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 6, + "column": 12, + "line": 2, }, "start": Object { - "column": 18, - "line": 6, + "column": 11, + "line": 2, }, }, "range": Array [ - 137, - 138, + 49, + 50, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 6, + "column": 17, + "line": 2, }, "start": Object { - "column": 19, - "line": 6, + "column": 12, + "line": 2, }, }, "range": Array [ - 138, - 139, + 50, + 55, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 6, + "column": 18, + "line": 2, }, "start": Object { - "column": 20, - "line": 6, + "column": 17, + "line": 2, }, }, "range": Array [ - 139, - 140, + 55, + 56, ], "type": "Punctuator", "value": ";", @@ -92581,16 +97951,16 @@ Object { "loc": Object { "end": Object { "column": 3, - "line": 7, + "line": 3, }, "start": Object { "column": 2, - "line": 7, + "line": 3, }, }, "range": Array [ - 143, - 144, + 59, + 60, ], "type": "Punctuator", "value": "(", @@ -92599,16 +97969,16 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 7, + "line": 3, }, "start": Object { "column": 3, - "line": 7, + "line": 3, }, }, "range": Array [ - 144, - 147, + 60, + 63, ], "type": "Identifier", "value": "one", @@ -92616,287 +97986,287 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, - "line": 7, + "column": 8, + "line": 3, }, "start": Object { "column": 6, - "line": 7, + "line": 3, }, }, "range": Array [ - 147, - 148, + 63, + 65, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 7, + "column": 11, + "line": 3, }, "start": Object { - "column": 7, - "line": 7, + "column": 8, + "line": 3, }, }, "range": Array [ - 148, - 149, + 65, + 68, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 7, + "column": 12, + "line": 3, }, "start": Object { - "column": 8, - "line": 7, + "column": 11, + "line": 3, }, }, "range": Array [ - 149, - 150, + 68, + 69, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 7, + "column": 13, + "line": 3, }, "start": Object { - "column": 9, - "line": 7, + "column": 12, + "line": 3, }, }, "range": Array [ - 150, - 152, + 69, + 70, ], "type": "Punctuator", - "value": "?.", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 7, + "column": 14, + "line": 3, }, "start": Object { - "column": 11, - "line": 7, + "column": 13, + "line": 3, }, }, "range": Array [ - 152, - 153, + 70, + 71, ], "type": "Punctuator", - "value": "[", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 7, + "column": 19, + "line": 3, }, "start": Object { - "column": 12, - "line": 7, + "column": 14, + "line": 3, }, }, "range": Array [ - 153, - 154, + 71, + 76, ], - "type": "Numeric", - "value": "3", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 7, + "column": 20, + "line": 3, }, "start": Object { - "column": 13, - "line": 7, + "column": 19, + "line": 3, }, }, "range": Array [ - 154, - 155, + 76, + 77, ], "type": "Punctuator", - "value": "]", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 7, + "column": 3, + "line": 4, }, "start": Object { - "column": 14, - "line": 7, + "column": 2, + "line": 4, }, }, "range": Array [ - 155, - 157, + 80, + 81, ], "type": "Punctuator", - "value": "?.", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 7, + "column": 6, + "line": 4, }, "start": Object { - "column": 16, - "line": 7, + "column": 3, + "line": 4, }, }, "range": Array [ - 157, - 158, + 81, + 84, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 7, + "column": 8, + "line": 4, }, "start": Object { - "column": 17, - "line": 7, + "column": 6, + "line": 4, }, }, "range": Array [ - 158, - 159, + 84, + 86, ], - "type": "Numeric", - "value": "4", + "type": "Punctuator", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 7, + "column": 11, + "line": 4, }, "start": Object { - "column": 18, - "line": 7, + "column": 8, + "line": 4, }, }, "range": Array [ - 159, - 160, + 86, + 89, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 7, + "column": 12, + "line": 4, }, "start": Object { - "column": 19, - "line": 7, + "column": 11, + "line": 4, }, }, "range": Array [ - 160, - 161, + 89, + 90, ], "type": "Punctuator", - "value": ")", + "value": "!", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 7, + "column": 13, + "line": 4, }, "start": Object { - "column": 20, - "line": 7, + "column": 12, + "line": 4, }, }, "range": Array [ - 161, - 162, + 90, + 91, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 7, + "column": 14, + "line": 4, }, "start": Object { - "column": 21, - "line": 7, + "column": 13, + "line": 4, }, }, "range": Array [ - 162, - 163, + 91, + 92, ], - "type": "Numeric", - "value": "5", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 7, + "column": 19, + "line": 4, }, "start": Object { - "column": 22, - "line": 7, + "column": 14, + "line": 4, }, }, "range": Array [ - 163, - 164, + 92, + 97, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 7, + "column": 20, + "line": 4, }, "start": Object { - "column": 23, - "line": 7, + "column": 19, + "line": 4, }, }, "range": Array [ - 164, - 165, + 97, + 98, ], "type": "Punctuator", "value": ";", @@ -92905,16 +98275,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 8, + "line": 5, }, "start": Object { "column": 0, - "line": 8, + "line": 5, }, }, "range": Array [ - 166, - 167, + 99, + 100, ], "type": "Punctuator", "value": "}", diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index 5f979fb94ad..ba617b57744 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -247,7 +247,7 @@ describe('semanticInfo', () => { badConfig.project = './tsconfigs.json'; expect(() => parseCodeAndGenerateServices(readFileSync(fileName, 'utf8'), badConfig), - ).toThrow(/File .+tsconfigs\.json' not found/); + ).toThrow(/Cannot read file .+tsconfigs\.json'/); }); it('fail to read project file', () => { @@ -258,7 +258,7 @@ describe('semanticInfo', () => { parseCodeAndGenerateServices(readFileSync(fileName, 'utf8'), badConfig), ).toThrow( // case insensitive because unix based systems are case insensitive - /File .+semanticInfo' not found/i, + /Cannot read file .+semanticInfo'./i, ); }); diff --git a/yarn.lock b/yarn.lock index e14dc9e7b49..8990a0267b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8451,10 +8451,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, "typescript@>=3.2.1 <3.9.0", typescript@^3.8.3: - version "3.8.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061" - integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w== +typescript@*, "typescript@>=3.2.1 <4.0.0", typescript@^3.8.3: + version "3.9.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.2.tgz#64e9c8e9be6ea583c54607677dd4680a1cf35db9" + integrity sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw== uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6"