From 603f22de76eaeac1a64ee5e5f2e1dd095f908604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Mon, 24 Apr 2023 23:59:19 +0900 Subject: [PATCH] test(es): Update tsc test suite (#7323) --- ...llowImportingTypesDtsExtension.1.normal.js | 10 + ...owImportingTypesDtsExtension.2.minified.js | 10 + .../arraySpreadInCall.1.normal.js | 65 + .../arraySpreadInCall.2.minified.js | 55 + .../checkJsxChildrenProperty16.1.normal.js | 13 + .../checkJsxChildrenProperty16.2.minified.js | 13 + .../contextualTypeTupleEnd.1.normal.js | 69 + .../contextualTypeTupleEnd.2.minified.js | 37 + .../tsc-references/es2022IntlAPIs.1.normal.js | 11 + .../es2022IntlAPIs.2.minified.js | 8 + ...ergedWithExportStarAsNamespace.1.normal.js | 8 + ...gedWithExportStarAsNamespace.2.minified.js | 8 + .../tsc-references/extendsTag5.1.normal.js | 70 + .../tsc-references/extendsTag5.2.minified.js | 4 + .../genericContextualTypes2.1.normal.js | 11 + .../genericContextualTypes2.2.minified.js | 11 + .../genericContextualTypes3.1.normal.js | 11 + .../genericContextualTypes3.2.minified.js | 11 + .../intraExpressionInferencesJsx.1.normal.js | 80 + ...intraExpressionInferencesJsx.2.minified.js | 1 + .../jsDeclarationsClassStatic2.1.normal.js | 38 + .../jsDeclarationsClassStatic2.2.minified.js | 33 + .../mappedTypeConstraints2.1.normal.js | 3 + .../tsc-references/overloadTag3.1.normal.js | 17 + .../tsc-references/overloadTag3.2.minified.js | 10 + ...FieldParenthesisLeftAssignment.1.normal.js | 25 + ...eldParenthesisLeftAssignment.2.minified.js | 3 + .../propertyAccessNumericLiterals.1.normal.js | 72 + ...ropertyAccessNumericLiterals.2.minified.js | 72 + ...hisPropertyAssignmentInherited.1.normal.js | 61 + ...sPropertyAssignmentInherited.2.minified.js | 51 + crates/swc_ecma_parser/.gitignore | 1 + crates/swc_ecma_parser/scripts/crlf.sh | 2 + .../tsc/allowImportingTypesDtsExtension.json | 370 ++ .../tsc/allowImportingTypesDtsExtension.ts | 19 + .../tests/tsc/arraySpreadInCall.json | 1928 ++++++ .../tests/tsc/arraySpreadInCall.ts | 25 + .../tests/tsc/bundlerSyntaxRestrictions.json | 312 +- .../tests/tsc/bundlerSyntaxRestrictions.ts | 1 + .../tests/tsc/checkJsxChildrenProperty16.tsx | 30 + .../tests/tsc/contextualTypeTupleEnd.json | 3320 ++++++++++ .../tests/tsc/contextualTypeTupleEnd.ts | 55 + .../tests/tsc/es2022IntlAPIs.json | 276 +- .../tests/tsc/es2022IntlAPIs.ts | 5 + ...rtTypeMergedWithExportStarAsNamespace.json | 876 +++ ...portTypeMergedWithExportStarAsNamespace.ts | 14 + .../tests/tsc/extendsTag5.json | 248 + .../swc_ecma_parser/tests/tsc/extendsTag5.ts | 49 + .../tests/tsc/genericContextualTypes2.json | 1861 ++++++ .../tests/tsc/genericContextualTypes2.ts | 41 + .../tests/tsc/genericContextualTypes3.json | 1829 ++++++ .../tests/tsc/genericContextualTypes3.ts | 41 + .../tsc/intraExpressionInferencesJsx.tsx | 112 + .../tests/tsc/jsDeclarationsClassStatic2.json | 306 + .../tests/tsc/jsDeclarationsClassStatic2.ts | 17 + .../tests/tsc/mappedTypeConstraints2.json | 513 +- .../tests/tsc/mappedTypeConstraints2.ts | 10 + .../tests/tsc/mappedTypeRelationships.json | 912 ++- .../tests/tsc/mappedTypeRelationships.ts | 18 + .../tests/tsc/overloadTag3.json | 224 + .../swc_ecma_parser/tests/tsc/overloadTag3.ts | 24 + ...ateNameFieldParenthesisLeftAssignment.json | 896 +++ ...ivateNameFieldParenthesisLeftAssignment.ts | 25 + .../tsc/propertyAccessNumericLiterals.json | 609 ++ .../tsc/propertyAccessNumericLiterals.ts | 13 + .../tsc/thisPropertyAssignmentInherited.json | 576 ++ .../tsc/thisPropertyAssignmentInherited.ts | 23 + .../tests/tsc/unknownControlFlow.json | 5822 ++++++++--------- .../tests/tsc/unknownControlFlow.ts | 2 +- crates/swc_ecma_parser/tests/typescript.rs | 3 +- 70 files changed, 19227 insertions(+), 3072 deletions(-) create mode 100644 crates/swc/tests/tsc-references/allowImportingTypesDtsExtension.1.normal.js create mode 100644 crates/swc/tests/tsc-references/allowImportingTypesDtsExtension.2.minified.js create mode 100644 crates/swc/tests/tsc-references/arraySpreadInCall.1.normal.js create mode 100644 crates/swc/tests/tsc-references/arraySpreadInCall.2.minified.js create mode 100644 crates/swc/tests/tsc-references/checkJsxChildrenProperty16.1.normal.js create mode 100644 crates/swc/tests/tsc-references/checkJsxChildrenProperty16.2.minified.js create mode 100644 crates/swc/tests/tsc-references/contextualTypeTupleEnd.1.normal.js create mode 100644 crates/swc/tests/tsc-references/contextualTypeTupleEnd.2.minified.js create mode 100644 crates/swc/tests/tsc-references/exportTypeMergedWithExportStarAsNamespace.1.normal.js create mode 100644 crates/swc/tests/tsc-references/exportTypeMergedWithExportStarAsNamespace.2.minified.js create mode 100644 crates/swc/tests/tsc-references/extendsTag5.1.normal.js create mode 100644 crates/swc/tests/tsc-references/extendsTag5.2.minified.js create mode 100644 crates/swc/tests/tsc-references/genericContextualTypes2.1.normal.js create mode 100644 crates/swc/tests/tsc-references/genericContextualTypes2.2.minified.js create mode 100644 crates/swc/tests/tsc-references/genericContextualTypes3.1.normal.js create mode 100644 crates/swc/tests/tsc-references/genericContextualTypes3.2.minified.js create mode 100644 crates/swc/tests/tsc-references/intraExpressionInferencesJsx.1.normal.js create mode 100644 crates/swc/tests/tsc-references/intraExpressionInferencesJsx.2.minified.js create mode 100644 crates/swc/tests/tsc-references/jsDeclarationsClassStatic2.1.normal.js create mode 100644 crates/swc/tests/tsc-references/jsDeclarationsClassStatic2.2.minified.js create mode 100644 crates/swc/tests/tsc-references/overloadTag3.1.normal.js create mode 100644 crates/swc/tests/tsc-references/overloadTag3.2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameFieldParenthesisLeftAssignment.1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameFieldParenthesisLeftAssignment.2.minified.js create mode 100644 crates/swc/tests/tsc-references/propertyAccessNumericLiterals.1.normal.js create mode 100644 crates/swc/tests/tsc-references/propertyAccessNumericLiterals.2.minified.js create mode 100644 crates/swc/tests/tsc-references/thisPropertyAssignmentInherited.1.normal.js create mode 100644 crates/swc/tests/tsc-references/thisPropertyAssignmentInherited.2.minified.js create mode 100644 crates/swc_ecma_parser/.gitignore create mode 100644 crates/swc_ecma_parser/tests/tsc/allowImportingTypesDtsExtension.json create mode 100644 crates/swc_ecma_parser/tests/tsc/allowImportingTypesDtsExtension.ts create mode 100644 crates/swc_ecma_parser/tests/tsc/arraySpreadInCall.json create mode 100644 crates/swc_ecma_parser/tests/tsc/arraySpreadInCall.ts create mode 100644 crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty16.tsx create mode 100644 crates/swc_ecma_parser/tests/tsc/contextualTypeTupleEnd.json create mode 100644 crates/swc_ecma_parser/tests/tsc/contextualTypeTupleEnd.ts create mode 100644 crates/swc_ecma_parser/tests/tsc/exportTypeMergedWithExportStarAsNamespace.json create mode 100644 crates/swc_ecma_parser/tests/tsc/exportTypeMergedWithExportStarAsNamespace.ts create mode 100644 crates/swc_ecma_parser/tests/tsc/extendsTag5.json create mode 100644 crates/swc_ecma_parser/tests/tsc/extendsTag5.ts create mode 100644 crates/swc_ecma_parser/tests/tsc/genericContextualTypes2.json create mode 100644 crates/swc_ecma_parser/tests/tsc/genericContextualTypes2.ts create mode 100644 crates/swc_ecma_parser/tests/tsc/genericContextualTypes3.json create mode 100644 crates/swc_ecma_parser/tests/tsc/genericContextualTypes3.ts create mode 100644 crates/swc_ecma_parser/tests/tsc/intraExpressionInferencesJsx.tsx create mode 100644 crates/swc_ecma_parser/tests/tsc/jsDeclarationsClassStatic2.json create mode 100644 crates/swc_ecma_parser/tests/tsc/jsDeclarationsClassStatic2.ts create mode 100644 crates/swc_ecma_parser/tests/tsc/overloadTag3.json create mode 100644 crates/swc_ecma_parser/tests/tsc/overloadTag3.ts create mode 100644 crates/swc_ecma_parser/tests/tsc/privateNameFieldParenthesisLeftAssignment.json create mode 100644 crates/swc_ecma_parser/tests/tsc/privateNameFieldParenthesisLeftAssignment.ts create mode 100644 crates/swc_ecma_parser/tests/tsc/propertyAccessNumericLiterals.json create mode 100644 crates/swc_ecma_parser/tests/tsc/propertyAccessNumericLiterals.ts create mode 100644 crates/swc_ecma_parser/tests/tsc/thisPropertyAssignmentInherited.json create mode 100644 crates/swc_ecma_parser/tests/tsc/thisPropertyAssignmentInherited.ts diff --git a/crates/swc/tests/tsc-references/allowImportingTypesDtsExtension.1.normal.js b/crates/swc/tests/tsc-references/allowImportingTypesDtsExtension.1.normal.js new file mode 100644 index 000000000000..af589c1e247a --- /dev/null +++ b/crates/swc/tests/tsc-references/allowImportingTypesDtsExtension.1.normal.js @@ -0,0 +1,10 @@ +//// [allowImportingTypesDtsExtension.ts] +//// [/types.d.ts] +export { }; +//// [/a.ts] +export var user = { + name: "John" +}; +export function getUser() { + return user; +} diff --git a/crates/swc/tests/tsc-references/allowImportingTypesDtsExtension.2.minified.js b/crates/swc/tests/tsc-references/allowImportingTypesDtsExtension.2.minified.js new file mode 100644 index 000000000000..af589c1e247a --- /dev/null +++ b/crates/swc/tests/tsc-references/allowImportingTypesDtsExtension.2.minified.js @@ -0,0 +1,10 @@ +//// [allowImportingTypesDtsExtension.ts] +//// [/types.d.ts] +export { }; +//// [/a.ts] +export var user = { + name: "John" +}; +export function getUser() { + return user; +} diff --git a/crates/swc/tests/tsc-references/arraySpreadInCall.1.normal.js b/crates/swc/tests/tsc-references/arraySpreadInCall.1.normal.js new file mode 100644 index 000000000000..ad97b73914ef --- /dev/null +++ b/crates/swc/tests/tsc-references/arraySpreadInCall.1.normal.js @@ -0,0 +1,65 @@ +//// [arraySpreadInCall.ts] +var _action; +f1.apply(void 0, [ + 1, + 2, + 3, + 4, + 5, + 6 +]); +f1.apply(void 0, [ + 1, + 2, + 3, + 4, + 5, + 6 +]); +f1.apply(void 0, [ + 1, + 2, + 3, + 4, + 5, + 6 +]); +f1.apply(void 0, [ + 1, + 2, + 3, + 4, + 5, + 6 +]); +f1.apply(void 0, [ + 1, + 2, + 3, + 4, + 5, + 6 +]); +var x21 = f2.apply(void 0, [ + 1, + "foo" +]); +var x22 = f2.apply(void 0, [ + true, + 1, + "foo" +]); +var x31 = f3.apply(void 0, [ + 1, + "foo" +]); +var x32 = f3.apply(void 0, [ + true, + 1, + "foo" +]); +(_action = action).run.apply(_action, [ + 100, + "foo" +] // error +); diff --git a/crates/swc/tests/tsc-references/arraySpreadInCall.2.minified.js b/crates/swc/tests/tsc-references/arraySpreadInCall.2.minified.js new file mode 100644 index 000000000000..df17ff919160 --- /dev/null +++ b/crates/swc/tests/tsc-references/arraySpreadInCall.2.minified.js @@ -0,0 +1,55 @@ +//// [arraySpreadInCall.ts] +var _action; +f1.apply(void 0, [ + 1, + 2, + 3, + 4, + 5, + 6 +]), f1.apply(void 0, [ + 1, + 2, + 3, + 4, + 5, + 6 +]), f1.apply(void 0, [ + 1, + 2, + 3, + 4, + 5, + 6 +]), f1.apply(void 0, [ + 1, + 2, + 3, + 4, + 5, + 6 +]), f1.apply(void 0, [ + 1, + 2, + 3, + 4, + 5, + 6 +]), f2.apply(void 0, [ + 1, + "foo" +]), f2.apply(void 0, [ + !0, + 1, + "foo" +]), f3.apply(void 0, [ + 1, + "foo" +]), f3.apply(void 0, [ + !0, + 1, + "foo" +]), (_action = action).run.apply(_action, [ + 100, + "foo" +]); diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty16.1.normal.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty16.1.normal.js new file mode 100644 index 000000000000..d6e362d9fdf6 --- /dev/null +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty16.1.normal.js @@ -0,0 +1,13 @@ +//// [checkJsxChildrenProperty16.tsx] +//! +//! x Import assignment cannot be used when targeting ECMAScript modules. Consider using `import * as ns from "mod"`, `import {a} from "mod"`, `import d from "mod"`, or another module format instead. +//! ,-[3:1] +//! 3 | +//! 4 | // repro from #53493 +//! 5 | +//! 6 | import React = require('react'); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! 7 | +//! 8 | export type Props = +//! 9 | | { renderNumber?: false; children: (arg: string) => void } +//! `---- diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty16.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty16.2.minified.js new file mode 100644 index 000000000000..d6e362d9fdf6 --- /dev/null +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty16.2.minified.js @@ -0,0 +1,13 @@ +//// [checkJsxChildrenProperty16.tsx] +//! +//! x Import assignment cannot be used when targeting ECMAScript modules. Consider using `import * as ns from "mod"`, `import {a} from "mod"`, `import d from "mod"`, or another module format instead. +//! ,-[3:1] +//! 3 | +//! 4 | // repro from #53493 +//! 5 | +//! 6 | import React = require('react'); +//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//! 7 | +//! 8 | export type Props = +//! 9 | | { renderNumber?: false; children: (arg: string) => void } +//! `---- diff --git a/crates/swc/tests/tsc-references/contextualTypeTupleEnd.1.normal.js b/crates/swc/tests/tsc-references/contextualTypeTupleEnd.1.normal.js new file mode 100644 index 000000000000..af094d169ae7 --- /dev/null +++ b/crates/swc/tests/tsc-references/contextualTypeTupleEnd.1.normal.js @@ -0,0 +1,69 @@ +//// [contextualTypeTupleEnd.ts] +f1(); // Error +f1(function(x) { + return str(x); +}); +f1(function(x) { + return num(x); +}, function(x) { + return str(x); +}); +f1(function(x) { + return num(x); +}, function(x) { + return num(x); +}, function(x) { + return str(x); +}); +var a0 = []; // Error +var a1 = [ + function(x) { + return str(x); + } +]; +var a2 = [ + function(x) { + return num(x); + }, + function(x) { + return str(x); + } +]; +var a3 = [ + function(x) { + return num(x); + }, + function(x) { + return num(x); + }, + function(x) { + return str(x); + } +]; +export function createSelector() { + for(var _len = arguments.length, selectors = new Array(_len), _key = 0; _key < _len; _key++){ + selectors[_key] = arguments[_key]; + } + console.log(selectors); +} +createSelector(function(x) { + return x.foo; +}, function(x) { + return x.bar; +}, function() { + return 42; +}); +example(function(x) { + return x.foo; +}, function(x) { + return x.bar; +}, function(x) { + return x.baz; +}); +test(function(a) { + return a; +}, function(b) { + return b; +}, function(c) { + return c; +}); diff --git a/crates/swc/tests/tsc-references/contextualTypeTupleEnd.2.minified.js b/crates/swc/tests/tsc-references/contextualTypeTupleEnd.2.minified.js new file mode 100644 index 000000000000..de9ce4b7e72b --- /dev/null +++ b/crates/swc/tests/tsc-references/contextualTypeTupleEnd.2.minified.js @@ -0,0 +1,37 @@ +//// [contextualTypeTupleEnd.ts] +f1(), f1(function(x) { + return str(x); +}), f1(function(x) { + return num(x); +}, function(x) { + return str(x); +}), f1(function(x) { + return num(x); +}, function(x) { + return num(x); +}, function(x) { + return str(x); +}); +export function createSelector() { + for(var _len = arguments.length, selectors = Array(_len), _key = 0; _key < _len; _key++)selectors[_key] = arguments[_key]; + console.log(selectors); +} +createSelector(function(x) { + return x.foo; +}, function(x) { + return x.bar; +}, function() { + return 42; +}), example(function(x) { + return x.foo; +}, function(x) { + return x.bar; +}, function(x) { + return x.baz; +}), test(function(a) { + return a; +}, function(b) { + return b; +}, function(c) { + return c; +}); diff --git a/crates/swc/tests/tsc-references/es2022IntlAPIs.1.normal.js b/crates/swc/tests/tsc-references/es2022IntlAPIs.1.normal.js index a58216cfcea5..2c6b1792ad24 100644 --- a/crates/swc/tests/tsc-references/es2022IntlAPIs.1.normal.js +++ b/crates/swc/tests/tsc-references/es2022IntlAPIs.1.normal.js @@ -14,3 +14,14 @@ for (const zoneName of timezoneNames){ timeZoneName: zoneName }); } +const enumerationKeys = [ + 'calendar', + 'collation', + 'currency', + 'numberingSystem', + 'timeZone', + 'unit' +]; +for (const key of enumerationKeys){ + var supported = Intl.supportedValuesOf(key); +} diff --git a/crates/swc/tests/tsc-references/es2022IntlAPIs.2.minified.js b/crates/swc/tests/tsc-references/es2022IntlAPIs.2.minified.js index 4f8a18eec935..ca535782707c 100644 --- a/crates/swc/tests/tsc-references/es2022IntlAPIs.2.minified.js +++ b/crates/swc/tests/tsc-references/es2022IntlAPIs.2.minified.js @@ -10,3 +10,11 @@ for (const zoneName of [ timeZone: 'America/Los_Angeles', timeZoneName: zoneName }); +for (const key of [ + 'calendar', + 'collation', + 'currency', + 'numberingSystem', + 'timeZone', + 'unit' +])Intl.supportedValuesOf(key); diff --git a/crates/swc/tests/tsc-references/exportTypeMergedWithExportStarAsNamespace.1.normal.js b/crates/swc/tests/tsc-references/exportTypeMergedWithExportStarAsNamespace.1.normal.js new file mode 100644 index 000000000000..cd03cc7ff13e --- /dev/null +++ b/crates/swc/tests/tsc-references/exportTypeMergedWithExportStarAsNamespace.1.normal.js @@ -0,0 +1,8 @@ +//// [usage.ts] +import { Something } from "./prelude"; +export var myValue = Something.of("abc"); +//// [Something.ts] +export { }; +//// [prelude.ts] +import * as _Something from "./Something"; +export { _Something as Something }; diff --git a/crates/swc/tests/tsc-references/exportTypeMergedWithExportStarAsNamespace.2.minified.js b/crates/swc/tests/tsc-references/exportTypeMergedWithExportStarAsNamespace.2.minified.js new file mode 100644 index 000000000000..cd03cc7ff13e --- /dev/null +++ b/crates/swc/tests/tsc-references/exportTypeMergedWithExportStarAsNamespace.2.minified.js @@ -0,0 +1,8 @@ +//// [usage.ts] +import { Something } from "./prelude"; +export var myValue = Something.of("abc"); +//// [Something.ts] +export { }; +//// [prelude.ts] +import * as _Something from "./Something"; +export { _Something as Something }; diff --git a/crates/swc/tests/tsc-references/extendsTag5.1.normal.js b/crates/swc/tests/tsc-references/extendsTag5.1.normal.js new file mode 100644 index 000000000000..8d6c95fe0d08 --- /dev/null +++ b/crates/swc/tests/tsc-references/extendsTag5.1.normal.js @@ -0,0 +1,70 @@ +//// [/a.js] +/** + * @typedef {{ +* a: number | string; +* b: boolean | string[]; +* }} Foo +*/ /** +* @template {Foo} T +*/ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +import { _ as _create_super } from "@swc/helpers/_/_create_super"; +var A = function A(a) { + "use strict"; + _class_call_check(this, A); + return a; +}; +/** +* @extends {A<{ +* a: string, +* b: string[] +* }>} +*/ var B = /*#__PURE__*/ function(A) { + "use strict"; + _inherits(B, A); + var _super = _create_super(B); + function B() { + _class_call_check(this, B); + return _super.apply(this, arguments); + } + return B; +}(A); +/** + * @extends {A<{ + * a: string, + * b: string + * }>} + */ var C = /*#__PURE__*/ function(A) { + "use strict"; + _inherits(C, A); + var _super = _create_super(C); + function C() { + _class_call_check(this, C); + return _super.apply(this, arguments); + } + return C; +}(A); +/** + * @extends {A<{a: string, b: string[]}>} + */ var D = /*#__PURE__*/ function(A) { + "use strict"; + _inherits(D, A); + var _super = _create_super(D); + function D() { + _class_call_check(this, D); + return _super.apply(this, arguments); + } + return D; +}(A); +/** + * @extends {A<{a: string, b: string}>} + */ var E = /*#__PURE__*/ function(A) { + "use strict"; + _inherits(E, A); + var _super = _create_super(E); + function E() { + _class_call_check(this, E); + return _super.apply(this, arguments); + } + return E; +}(A); diff --git a/crates/swc/tests/tsc-references/extendsTag5.2.minified.js b/crates/swc/tests/tsc-references/extendsTag5.2.minified.js new file mode 100644 index 000000000000..7fcacbda8544 --- /dev/null +++ b/crates/swc/tests/tsc-references/extendsTag5.2.minified.js @@ -0,0 +1,4 @@ +//// [/a.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +import { _ as _create_super } from "@swc/helpers/_/_create_super"; diff --git a/crates/swc/tests/tsc-references/genericContextualTypes2.1.normal.js b/crates/swc/tests/tsc-references/genericContextualTypes2.1.normal.js new file mode 100644 index 000000000000..a1e6a97b4b3e --- /dev/null +++ b/crates/swc/tests/tsc-references/genericContextualTypes2.1.normal.js @@ -0,0 +1,11 @@ +//// [genericContextualTypes2.ts] +createMachine({ + context: { + count: 0 + }, + entry: assign({ + count: function(ctx) { + return ++ctx.count; + } + }) +}); diff --git a/crates/swc/tests/tsc-references/genericContextualTypes2.2.minified.js b/crates/swc/tests/tsc-references/genericContextualTypes2.2.minified.js new file mode 100644 index 000000000000..a1e6a97b4b3e --- /dev/null +++ b/crates/swc/tests/tsc-references/genericContextualTypes2.2.minified.js @@ -0,0 +1,11 @@ +//// [genericContextualTypes2.ts] +createMachine({ + context: { + count: 0 + }, + entry: assign({ + count: function(ctx) { + return ++ctx.count; + } + }) +}); diff --git a/crates/swc/tests/tsc-references/genericContextualTypes3.1.normal.js b/crates/swc/tests/tsc-references/genericContextualTypes3.1.normal.js new file mode 100644 index 000000000000..21af1694a61b --- /dev/null +++ b/crates/swc/tests/tsc-references/genericContextualTypes3.1.normal.js @@ -0,0 +1,11 @@ +//// [genericContextualTypes3.ts] +createMachine({ + context: { + count: 0 + }, + entry: assign({ + count: function(ctx) { + return ++ctx.count; + } + }) +}); diff --git a/crates/swc/tests/tsc-references/genericContextualTypes3.2.minified.js b/crates/swc/tests/tsc-references/genericContextualTypes3.2.minified.js new file mode 100644 index 000000000000..21af1694a61b --- /dev/null +++ b/crates/swc/tests/tsc-references/genericContextualTypes3.2.minified.js @@ -0,0 +1,11 @@ +//// [genericContextualTypes3.ts] +createMachine({ + context: { + count: 0 + }, + entry: assign({ + count: function(ctx) { + return ++ctx.count; + } + }) +}); diff --git a/crates/swc/tests/tsc-references/intraExpressionInferencesJsx.1.normal.js b/crates/swc/tests/tsc-references/intraExpressionInferencesJsx.1.normal.js new file mode 100644 index 000000000000..0f1df489db4b --- /dev/null +++ b/crates/swc/tests/tsc-references/intraExpressionInferencesJsx.1.normal.js @@ -0,0 +1,80 @@ +//// [intraExpressionInferencesJsx.tsx] +/// +// repro from #52798 +var Component = function(param) { + var animations = param.animations, style = param.style; + return /*#__PURE__*/ React.createElement(React.Fragment, null); +}; +/*#__PURE__*/ React.createElement(Component, { + animations: { + test: { + kind: "a", + value: 1, + a: true + } + }, + style: function(anim) { + return ""; + } +}); +/*#__PURE__*/ React.createElement(Component, { + animations: { + test: { + kind: "a", + value: 1, + a: true, + func: function func() { + return { + a: true + }; + } + } + }, + style: function(anim) { + return ""; + } +}); +/*#__PURE__*/ React.createElement(Component, { + animations: { + test: { + kind: "a", + value: 1, + a: true, + func: function() { + return { + a: true + }; + } + } + }, + style: function(anim) { + return ""; + } +}); +function Foo(props) { + return /*#__PURE__*/ React.createElement("div", null); +} +/*#__PURE__*/ React.createElement(Foo, { + a: function() { + return 10; + }, + b: function(arg) { + arg.toString(); + } +}); +/*#__PURE__*/ React.createElement(Foo, { + a: function(x) { + return 10; + }, + b: function(arg) { + arg.toString(); + } +}); +/*#__PURE__*/ React.createElement(Foo, { + a: function(x) { + return 10; + }, + b: function(arg) { + arg.toString(); + } +}); diff --git a/crates/swc/tests/tsc-references/intraExpressionInferencesJsx.2.minified.js b/crates/swc/tests/tsc-references/intraExpressionInferencesJsx.2.minified.js new file mode 100644 index 000000000000..ee9743e644e9 --- /dev/null +++ b/crates/swc/tests/tsc-references/intraExpressionInferencesJsx.2.minified.js @@ -0,0 +1 @@ +//// [intraExpressionInferencesJsx.tsx] diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassStatic2.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsClassStatic2.1.normal.js new file mode 100644 index 000000000000..a9682f0ab3ca --- /dev/null +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassStatic2.1.normal.js @@ -0,0 +1,38 @@ +//// [Foo.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +import { _ as _create_super } from "@swc/helpers/_/_create_super"; +var Base = function Base() { + "use strict"; + _class_call_check(this, Base); +}; +(function() { + Base.foo = ""; +})(); +export var Foo = /*#__PURE__*/ function(Base) { + "use strict"; + _inherits(Foo, Base); + var _super = _create_super(Foo); + function Foo() { + _class_call_check(this, Foo); + return _super.apply(this, arguments); + } + return Foo; +}(Base); +Foo.foo = "foo"; +//// [Bar.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +import { _ as _create_super } from "@swc/helpers/_/_create_super"; +import { Foo } from "./Foo.js"; +var Bar = /*#__PURE__*/ function(Foo) { + "use strict"; + _inherits(Bar, Foo); + var _super = _create_super(Bar); + function Bar() { + _class_call_check(this, Bar); + return _super.apply(this, arguments); + } + return Bar; +}(Foo); +Bar.foo = "foo"; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsClassStatic2.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsClassStatic2.2.minified.js new file mode 100644 index 000000000000..2cd05d755d94 --- /dev/null +++ b/crates/swc/tests/tsc-references/jsDeclarationsClassStatic2.2.minified.js @@ -0,0 +1,33 @@ +//// [Foo.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +import { _ as _create_super } from "@swc/helpers/_/_create_super"; +var Base = function Base() { + "use strict"; + _class_call_check(this, Base); +}; +Base.foo = ""; +export var Foo = function(Base) { + "use strict"; + _inherits(Foo, Base); + var _super = _create_super(Foo); + function Foo() { + return _class_call_check(this, Foo), _super.apply(this, arguments); + } + return Foo; +}(Base); +Foo.foo = "foo"; +//// [Bar.ts] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +import { _ as _create_super } from "@swc/helpers/_/_create_super"; +import { Foo } from "./Foo.js"; +(function(Foo) { + "use strict"; + _inherits(Bar, Foo); + var _super = _create_super(Bar); + function Bar() { + return _class_call_check(this, Bar), _super.apply(this, arguments); + } + return Bar; +})(Foo).foo = "foo"; diff --git a/crates/swc/tests/tsc-references/mappedTypeConstraints2.1.normal.js b/crates/swc/tests/tsc-references/mappedTypeConstraints2.1.normal.js index 5258538027a8..36f14a880d85 100644 --- a/crates/swc/tests/tsc-references/mappedTypeConstraints2.1.normal.js +++ b/crates/swc/tests/tsc-references/mappedTypeConstraints2.1.normal.js @@ -19,3 +19,6 @@ function validate(obj, bounds) { } return true; } +function genericTest(objectWithUnderscoredKeys, key) { + const shouldBeTrue = objectWithUnderscoredKeys[`_${key}`]; +} diff --git a/crates/swc/tests/tsc-references/overloadTag3.1.normal.js b/crates/swc/tests/tsc-references/overloadTag3.1.normal.js new file mode 100644 index 000000000000..89497aec20f3 --- /dev/null +++ b/crates/swc/tests/tsc-references/overloadTag3.1.normal.js @@ -0,0 +1,17 @@ +//// [/a.js] +/** + * @template T + */ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +export var Foo = /*#__PURE__*/ function() { + "use strict"; + function Foo() { + _class_call_check(this, Foo); + } + var _proto = Foo.prototype; + /** + * @param {T} value + */ _proto.bar = function bar(value) {}; + return Foo; +}(); +/** @type {Foo} */ var foo; +foo = new Foo(); diff --git a/crates/swc/tests/tsc-references/overloadTag3.2.minified.js b/crates/swc/tests/tsc-references/overloadTag3.2.minified.js new file mode 100644 index 000000000000..c7e97b3b4637 --- /dev/null +++ b/crates/swc/tests/tsc-references/overloadTag3.2.minified.js @@ -0,0 +1,10 @@ +//// [/a.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +export var Foo = function() { + "use strict"; + function Foo() { + _class_call_check(this, Foo); + } + return Foo.prototype.bar = function(value) {}, Foo; +}(); +new Foo(); diff --git a/crates/swc/tests/tsc-references/privateNameFieldParenthesisLeftAssignment.1.normal.js b/crates/swc/tests/tsc-references/privateNameFieldParenthesisLeftAssignment.1.normal.js new file mode 100644 index 000000000000..27d0b3f1c51f --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameFieldParenthesisLeftAssignment.1.normal.js @@ -0,0 +1,25 @@ +//// [privateNameFieldParenthesisLeftAssignment.ts] +import { _ as _class_private_field_init } from "@swc/helpers/_/_class_private_field_init"; +import { _ as _class_private_field_set } from "@swc/helpers/_/_class_private_field_set"; +var _p = /*#__PURE__*/ new WeakMap(); +class Foo { + t1(p) { + _class_private_field_set(this, _p, p); + } + t2(p) { + _class_private_field_set(this, _p, p); + } + t3(p) { + _class_private_field_set(this, _p, p); + } + t4(p) { + _class_private_field_set(this, _p, p); + } + constructor(value){ + _class_private_field_init(this, _p, { + writable: true, + value: void 0 + }); + _class_private_field_set(this, _p, value); + } +} diff --git a/crates/swc/tests/tsc-references/privateNameFieldParenthesisLeftAssignment.2.minified.js b/crates/swc/tests/tsc-references/privateNameFieldParenthesisLeftAssignment.2.minified.js new file mode 100644 index 000000000000..2022e2014cfb --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameFieldParenthesisLeftAssignment.2.minified.js @@ -0,0 +1,3 @@ +//// [privateNameFieldParenthesisLeftAssignment.ts] +import "@swc/helpers/_/_class_private_field_init"; +import "@swc/helpers/_/_class_private_field_set"; diff --git a/crates/swc/tests/tsc-references/propertyAccessNumericLiterals.1.normal.js b/crates/swc/tests/tsc-references/propertyAccessNumericLiterals.1.normal.js new file mode 100644 index 000000000000..74167725442a --- /dev/null +++ b/crates/swc/tests/tsc-references/propertyAccessNumericLiterals.1.normal.js @@ -0,0 +1,72 @@ +//// [propertyAccessNumericLiterals.ts] +//! +//! x Legacy octal literals are not available when targeting ECMAScript 5 and higher +//! ,-[3:1] +//! 3 | 0b01101101.toString(); +//! 4 | 1234..toString(); +//! 5 | 1e0.toString(); +//! 6 | 000.toString(); +//! : ^^^ +//! 7 | 08.8e5.toString(); +//! 8 | 0_8.8e5.toString(); +//! 9 | 8.8e5.toString(); +//! `---- +//! +//! x Legacy octal escape is not permitted in strict mode +//! ,-[3:1] +//! 3 | 0b01101101.toString(); +//! 4 | 1234..toString(); +//! 5 | 1e0.toString(); +//! 6 | 000.toString(); +//! : ^^^ +//! 7 | 08.8e5.toString(); +//! 8 | 0_8.8e5.toString(); +//! 9 | 8.8e5.toString(); +//! `---- +//! +//! x Legacy decimal escape is not permitted in strict mode +//! ,-[4:1] +//! 4 | 1234..toString(); +//! 5 | 1e0.toString(); +//! 6 | 000.toString(); +//! 7 | 08.8e5.toString(); +//! : ^^ +//! 8 | 0_8.8e5.toString(); +//! 9 | 8.8e5.toString(); +//! 10 | 088e4.toString(); +//! `---- +//! +//! x Legacy decimal escape is not permitted in strict mode +//! ,-[5:1] +//! 5 | 1e0.toString(); +//! 6 | 000.toString(); +//! 7 | 08.8e5.toString(); +//! 8 | 0_8.8e5.toString(); +//! : ^^^ +//! 9 | 8.8e5.toString(); +//! 10 | 088e4.toString(); +//! 11 | 88_e4.toString(); +//! `---- +//! +//! x Legacy decimal escape is not permitted in strict mode +//! ,-[7:1] +//! 7 | 08.8e5.toString(); +//! 8 | 0_8.8e5.toString(); +//! 9 | 8.8e5.toString(); +//! 10 | 088e4.toString(); +//! : ^^^ +//! 11 | 88_e4.toString(); +//! 12 | 88e4.toString(); +//! 13 | 8_8e4.toString(); +//! `---- +//! +//! x A numeric separator is only allowed between two digits +//! ,-[8:1] +//! 8 | 0_8.8e5.toString(); +//! 9 | 8.8e5.toString(); +//! 10 | 088e4.toString(); +//! 11 | 88_e4.toString(); +//! : ^^ +//! 12 | 88e4.toString(); +//! 13 | 8_8e4.toString(); +//! `---- diff --git a/crates/swc/tests/tsc-references/propertyAccessNumericLiterals.2.minified.js b/crates/swc/tests/tsc-references/propertyAccessNumericLiterals.2.minified.js new file mode 100644 index 000000000000..74167725442a --- /dev/null +++ b/crates/swc/tests/tsc-references/propertyAccessNumericLiterals.2.minified.js @@ -0,0 +1,72 @@ +//// [propertyAccessNumericLiterals.ts] +//! +//! x Legacy octal literals are not available when targeting ECMAScript 5 and higher +//! ,-[3:1] +//! 3 | 0b01101101.toString(); +//! 4 | 1234..toString(); +//! 5 | 1e0.toString(); +//! 6 | 000.toString(); +//! : ^^^ +//! 7 | 08.8e5.toString(); +//! 8 | 0_8.8e5.toString(); +//! 9 | 8.8e5.toString(); +//! `---- +//! +//! x Legacy octal escape is not permitted in strict mode +//! ,-[3:1] +//! 3 | 0b01101101.toString(); +//! 4 | 1234..toString(); +//! 5 | 1e0.toString(); +//! 6 | 000.toString(); +//! : ^^^ +//! 7 | 08.8e5.toString(); +//! 8 | 0_8.8e5.toString(); +//! 9 | 8.8e5.toString(); +//! `---- +//! +//! x Legacy decimal escape is not permitted in strict mode +//! ,-[4:1] +//! 4 | 1234..toString(); +//! 5 | 1e0.toString(); +//! 6 | 000.toString(); +//! 7 | 08.8e5.toString(); +//! : ^^ +//! 8 | 0_8.8e5.toString(); +//! 9 | 8.8e5.toString(); +//! 10 | 088e4.toString(); +//! `---- +//! +//! x Legacy decimal escape is not permitted in strict mode +//! ,-[5:1] +//! 5 | 1e0.toString(); +//! 6 | 000.toString(); +//! 7 | 08.8e5.toString(); +//! 8 | 0_8.8e5.toString(); +//! : ^^^ +//! 9 | 8.8e5.toString(); +//! 10 | 088e4.toString(); +//! 11 | 88_e4.toString(); +//! `---- +//! +//! x Legacy decimal escape is not permitted in strict mode +//! ,-[7:1] +//! 7 | 08.8e5.toString(); +//! 8 | 0_8.8e5.toString(); +//! 9 | 8.8e5.toString(); +//! 10 | 088e4.toString(); +//! : ^^^ +//! 11 | 88_e4.toString(); +//! 12 | 88e4.toString(); +//! 13 | 8_8e4.toString(); +//! `---- +//! +//! x A numeric separator is only allowed between two digits +//! ,-[8:1] +//! 8 | 0_8.8e5.toString(); +//! 9 | 8.8e5.toString(); +//! 10 | 088e4.toString(); +//! 11 | 88_e4.toString(); +//! : ^^ +//! 12 | 88e4.toString(); +//! 13 | 8_8e4.toString(); +//! `---- diff --git a/crates/swc/tests/tsc-references/thisPropertyAssignmentInherited.1.normal.js b/crates/swc/tests/tsc-references/thisPropertyAssignmentInherited.1.normal.js new file mode 100644 index 000000000000..11c55c1af5ba --- /dev/null +++ b/crates/swc/tests/tsc-references/thisPropertyAssignmentInherited.1.normal.js @@ -0,0 +1,61 @@ +//// [thisPropertyAssignmentInherited.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _create_class } from "@swc/helpers/_/_create_class"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +import { _ as _wrap_native_super } from "@swc/helpers/_/_wrap_native_super"; +import { _ as _create_super } from "@swc/helpers/_/_create_super"; +export var Element = /*#__PURE__*/ function() { + "use strict"; + function Element() { + _class_call_check(this, Element); + } + var _proto = Element.prototype; + _proto.cloneNode = function cloneNode() { + return this; + }; + _create_class(Element, [ + { + key: "textContent", + get: /** + * @returns {String} + */ function get() { + return ""; + }, + set: function set(x) {} + } + ]); + return Element; +}(); +export var HTMLElement = /*#__PURE__*/ function(Element) { + "use strict"; + _inherits(HTMLElement, Element); + var _super = _create_super(HTMLElement); + function HTMLElement() { + _class_call_check(this, HTMLElement); + return _super.apply(this, arguments); + } + return HTMLElement; +}(_wrap_native_super(Element)); +export var TextElement = /*#__PURE__*/ function(HTMLElement) { + "use strict"; + _inherits(TextElement, HTMLElement); + var _super = _create_super(TextElement); + function TextElement() { + _class_call_check(this, TextElement); + return _super.apply(this, arguments); + } + var _proto = TextElement.prototype; + _proto.toString = function toString() {}; + _create_class(TextElement, [ + { + key: "innerHTML", + get: function get() { + return this.textContent; + }, + set: function set(html) { + this.textContent = html; + } + } + ]); + return TextElement; +}(_wrap_native_super(HTMLElement)); diff --git a/crates/swc/tests/tsc-references/thisPropertyAssignmentInherited.2.minified.js b/crates/swc/tests/tsc-references/thisPropertyAssignmentInherited.2.minified.js new file mode 100644 index 000000000000..722000353eeb --- /dev/null +++ b/crates/swc/tests/tsc-references/thisPropertyAssignmentInherited.2.minified.js @@ -0,0 +1,51 @@ +//// [thisPropertyAssignmentInherited.js] +import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; +import { _ as _create_class } from "@swc/helpers/_/_create_class"; +import { _ as _inherits } from "@swc/helpers/_/_inherits"; +import { _ as _wrap_native_super } from "@swc/helpers/_/_wrap_native_super"; +import { _ as _create_super } from "@swc/helpers/_/_create_super"; +export var Element = function() { + "use strict"; + function Element() { + _class_call_check(this, Element); + } + return Element.prototype.cloneNode = function() { + return this; + }, _create_class(Element, [ + { + key: "textContent", + get: function() { + return ""; + }, + set: function(x) {} + } + ]), Element; +}(); +export var HTMLElement = function(Element) { + "use strict"; + _inherits(HTMLElement, Element); + var _super = _create_super(HTMLElement); + function HTMLElement() { + return _class_call_check(this, HTMLElement), _super.apply(this, arguments); + } + return HTMLElement; +}(_wrap_native_super(Element)); +export var TextElement = function(HTMLElement) { + "use strict"; + _inherits(TextElement, HTMLElement); + var _super = _create_super(TextElement); + function TextElement() { + return _class_call_check(this, TextElement), _super.apply(this, arguments); + } + return TextElement.prototype.toString = function() {}, _create_class(TextElement, [ + { + key: "innerHTML", + get: function() { + return this.textContent; + }, + set: function(html) { + this.textContent = html; + } + } + ]), TextElement; +}(_wrap_native_super(HTMLElement)); diff --git a/crates/swc_ecma_parser/.gitignore b/crates/swc_ecma_parser/.gitignore new file mode 100644 index 000000000000..212542e75bbb --- /dev/null +++ b/crates/swc_ecma_parser/.gitignore @@ -0,0 +1 @@ +tmp.tests/ \ No newline at end of file diff --git a/crates/swc_ecma_parser/scripts/crlf.sh b/crates/swc_ecma_parser/scripts/crlf.sh index 26db618cb99f..acc802ecd1a3 100755 --- a/crates/swc_ecma_parser/scripts/crlf.sh +++ b/crates/swc_ecma_parser/scripts/crlf.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash find tests/tsc -type f -exec ./scripts/dos2unix.sh {} \; +find tests/typescript -type f -exec ./scripts/dos2unix.sh {} \; +find tests/typescript-errors -type f -exec ./scripts/dos2unix.sh {} \; diff --git a/crates/swc_ecma_parser/tests/tsc/allowImportingTypesDtsExtension.json b/crates/swc_ecma_parser/tests/tsc/allowImportingTypesDtsExtension.json new file mode 100644 index 000000000000..5364fb866d1d --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/allowImportingTypesDtsExtension.json @@ -0,0 +1,370 @@ +{ + "type": "Module", + "span": { + "start": 169, + "end": 444, + "ctxt": 0 + }, + "body": [ + { + "type": "ExportDeclaration", + "span": { + "start": 169, + "end": 217, + "ctxt": 0 + }, + "declaration": { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 176, + "end": 217, + "ctxt": 0 + }, + "declare": true, + "id": { + "type": "Identifier", + "span": { + "start": 189, + "end": 193, + "ctxt": 0 + }, + "value": "User", + "optional": false + }, + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeLiteral", + "span": { + "start": 196, + "end": 217, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 202, + "end": 215, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 202, + "end": 206, + "ctxt": 0 + }, + "value": "name", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 206, + "end": 214, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 208, + "end": 214, + "ctxt": 0 + }, + "kind": "string" + } + }, + "typeParams": null + } + ] + } + } + }, + { + "type": "ImportDeclaration", + "span": { + "start": 239, + "end": 280, + "ctxt": 0 + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "span": { + "start": 253, + "end": 257, + "ctxt": 0 + }, + "local": { + "type": "Identifier", + "span": { + "start": 253, + "end": 257, + "ctxt": 0 + }, + "value": "User", + "optional": false + }, + "imported": null, + "isTypeOnly": false + } + ], + "source": { + "type": "StringLiteral", + "span": { + "start": 265, + "end": 279, + "ctxt": 0 + }, + "value": "./types.d.ts", + "raw": "\"./types.d.ts\"" + }, + "typeOnly": true, + "asserts": null + }, + { + "type": "ExportNamedDeclaration", + "span": { + "start": 281, + "end": 322, + "ctxt": 0 + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "span": { + "start": 295, + "end": 299, + "ctxt": 0 + }, + "orig": { + "type": "Identifier", + "span": { + "start": 295, + "end": 299, + "ctxt": 0 + }, + "value": "User", + "optional": false + }, + "exported": null, + "isTypeOnly": false + } + ], + "source": { + "type": "StringLiteral", + "span": { + "start": 307, + "end": 321, + "ctxt": 0 + }, + "value": "./types.d.ts", + "raw": "\"./types.d.ts\"" + }, + "typeOnly": true, + "asserts": null + }, + { + "type": "ExportDeclaration", + "span": { + "start": 324, + "end": 367, + "ctxt": 0 + }, + "declaration": { + "type": "VariableDeclaration", + "span": { + "start": 331, + "end": 367, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 337, + "end": 366, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 337, + "end": 341, + "ctxt": 0 + }, + "value": "user", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 341, + "end": 347, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 343, + "end": 347, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 343, + "end": 347, + "ctxt": 0 + }, + "value": "User", + "optional": false + }, + "typeParams": null + } + } + }, + "init": { + "type": "ObjectExpression", + "span": { + "start": 350, + "end": 366, + "ctxt": 0 + }, + "properties": [ + { + "type": "KeyValueProperty", + "key": { + "type": "Identifier", + "span": { + "start": 352, + "end": 356, + "ctxt": 0 + }, + "value": "name", + "optional": false + }, + "value": { + "type": "StringLiteral", + "span": { + "start": 358, + "end": 364, + "ctxt": 0 + }, + "value": "John", + "raw": "\"John\"" + } + } + ] + }, + "definite": false + } + ] + } + }, + { + "type": "ExportDeclaration", + "span": { + "start": 369, + "end": 444, + "ctxt": 0 + }, + "declaration": { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 385, + "end": 392, + "ctxt": 0 + }, + "value": "getUser", + "optional": false + }, + "declare": false, + "params": [], + "decorators": [], + "span": { + "start": 376, + "end": 444, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 424, + "end": 444, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ReturnStatement", + "span": { + "start": 430, + "end": 442, + "ctxt": 0 + }, + "argument": { + "type": "Identifier", + "span": { + "start": 437, + "end": 441, + "ctxt": 0 + }, + "value": "user", + "optional": false + } + } + ] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 394, + "end": 423, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsImportType", + "span": { + "start": 396, + "end": 423, + "ctxt": 0 + }, + "argument": { + "type": "StringLiteral", + "span": { + "start": 403, + "end": 417, + "ctxt": 0 + }, + "value": "./types.d.ts", + "raw": "\"./types.d.ts\"" + }, + "qualifier": { + "type": "Identifier", + "span": { + "start": 419, + "end": 423, + "ctxt": 0 + }, + "value": "User", + "optional": false + }, + "typeArguments": null + } + } + } + } + ], + "interpreter": null +} diff --git a/crates/swc_ecma_parser/tests/tsc/allowImportingTypesDtsExtension.ts b/crates/swc_ecma_parser/tests/tsc/allowImportingTypesDtsExtension.ts new file mode 100644 index 000000000000..dc43f91e63d1 --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/allowImportingTypesDtsExtension.ts @@ -0,0 +1,19 @@ +// @allowImportingTsExtensions: true,false +// @noEmit: true +// @moduleResolution: classic,node10,node16,nodenext +// @noTypesAndSymbols: true + +// @Filename: /types.d.ts +export declare type User = { + name: string; +} + +// @Filename: /a.ts +import type { User } from "./types.d.ts"; +export type { User } from "./types.d.ts"; + +export const user: User = { name: "John" }; + +export function getUser(): import("./types.d.ts").User { + return user; +} diff --git a/crates/swc_ecma_parser/tests/tsc/arraySpreadInCall.json b/crates/swc_ecma_parser/tests/tsc/arraySpreadInCall.json new file mode 100644 index 000000000000..67cd2549611b --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/arraySpreadInCall.json @@ -0,0 +1,1928 @@ +{ + "type": "Script", + "span": { + "start": 36, + "end": 698, + "ctxt": 0 + }, + "body": [ + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 53, + "end": 55, + "ctxt": 0 + }, + "value": "f1", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 56, + "end": 65, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 56, + "end": 65, + "ctxt": 0 + }, + "value": "a", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 57, + "end": 65, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 59, + "end": 65, + "ctxt": 0 + }, + "kind": "number" + } + } + } + }, + { + "type": "Parameter", + "span": { + "start": 67, + "end": 76, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 67, + "end": 76, + "ctxt": 0 + }, + "value": "b", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 68, + "end": 76, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 70, + "end": 76, + "ctxt": 0 + }, + "kind": "number" + } + } + } + }, + { + "type": "Parameter", + "span": { + "start": 78, + "end": 87, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 78, + "end": 87, + "ctxt": 0 + }, + "value": "c", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 79, + "end": 87, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 81, + "end": 87, + "ctxt": 0 + }, + "kind": "number" + } + } + } + }, + { + "type": "Parameter", + "span": { + "start": 89, + "end": 98, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 89, + "end": 98, + "ctxt": 0 + }, + "value": "d", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 90, + "end": 98, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 92, + "end": 98, + "ctxt": 0 + }, + "kind": "number" + } + } + } + }, + { + "type": "Parameter", + "span": { + "start": 100, + "end": 109, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 100, + "end": 109, + "ctxt": 0 + }, + "value": "e", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 101, + "end": 109, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 103, + "end": 109, + "ctxt": 0 + }, + "kind": "number" + } + } + } + }, + { + "type": "Parameter", + "span": { + "start": 111, + "end": 120, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 111, + "end": 120, + "ctxt": 0 + }, + "value": "f", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 112, + "end": 120, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 114, + "end": 120, + "ctxt": 0 + }, + "kind": "number" + } + } + } + } + ], + "decorators": [], + "span": { + "start": 36, + "end": 128, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 121, + "end": 127, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 123, + "end": 127, + "ctxt": 0 + }, + "kind": "void" + } + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 129, + "end": 155, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 129, + "end": 154, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 129, + "end": 131, + "ctxt": 0 + }, + "value": "f1", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 132, + "end": 133, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 135, + "end": 136, + "ctxt": 0 + }, + "value": 2.0, + "raw": "2" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 138, + "end": 139, + "ctxt": 0 + }, + "value": 3.0, + "raw": "3" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 141, + "end": 142, + "ctxt": 0 + }, + "value": 4.0, + "raw": "4" + } + }, + { + "spread": { + "start": 144, + "end": 147, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 147, + "end": 153, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 148, + "end": 149, + "ctxt": 0 + }, + "value": 5.0, + "raw": "5" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 151, + "end": 152, + "ctxt": 0 + }, + "value": 6.0, + "raw": "6" + } + } + ] + } + } + ], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 156, + "end": 182, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 156, + "end": 181, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 156, + "end": 158, + "ctxt": 0 + }, + "value": "f1", + "optional": false + }, + "arguments": [ + { + "spread": { + "start": 159, + "end": 162, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 162, + "end": 165, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 163, + "end": 164, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + } + } + ] + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 167, + "end": 168, + "ctxt": 0 + }, + "value": 2.0, + "raw": "2" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 170, + "end": 171, + "ctxt": 0 + }, + "value": 3.0, + "raw": "3" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 173, + "end": 174, + "ctxt": 0 + }, + "value": 4.0, + "raw": "4" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 176, + "end": 177, + "ctxt": 0 + }, + "value": 5.0, + "raw": "5" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 179, + "end": 180, + "ctxt": 0 + }, + "value": 6.0, + "raw": "6" + } + } + ], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 183, + "end": 209, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 183, + "end": 208, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 183, + "end": 185, + "ctxt": 0 + }, + "value": "f1", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 186, + "end": 187, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 189, + "end": 190, + "ctxt": 0 + }, + "value": 2.0, + "raw": "2" + } + }, + { + "spread": { + "start": 192, + "end": 195, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 195, + "end": 201, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 196, + "end": 197, + "ctxt": 0 + }, + "value": 3.0, + "raw": "3" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 199, + "end": 200, + "ctxt": 0 + }, + "value": 4.0, + "raw": "4" + } + } + ] + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 203, + "end": 204, + "ctxt": 0 + }, + "value": 5.0, + "raw": "5" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 206, + "end": 207, + "ctxt": 0 + }, + "value": 6.0, + "raw": "6" + } + } + ], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 210, + "end": 241, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 210, + "end": 240, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 210, + "end": 212, + "ctxt": 0 + }, + "value": "f1", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 213, + "end": 214, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 216, + "end": 217, + "ctxt": 0 + }, + "value": 2.0, + "raw": "2" + } + }, + { + "spread": { + "start": 219, + "end": 222, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 222, + "end": 225, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 223, + "end": 224, + "ctxt": 0 + }, + "value": 3.0, + "raw": "3" + } + } + ] + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 227, + "end": 228, + "ctxt": 0 + }, + "value": 4.0, + "raw": "4" + } + }, + { + "spread": { + "start": 230, + "end": 233, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 233, + "end": 239, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 234, + "end": 235, + "ctxt": 0 + }, + "value": 5.0, + "raw": "5" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 237, + "end": 238, + "ctxt": 0 + }, + "value": 6.0, + "raw": "6" + } + } + ] + } + } + ], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 242, + "end": 278, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 242, + "end": 277, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 242, + "end": 244, + "ctxt": 0 + }, + "value": "f1", + "optional": false + }, + "arguments": [ + { + "spread": { + "start": 245, + "end": 248, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 248, + "end": 254, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 249, + "end": 250, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 252, + "end": 253, + "ctxt": 0 + }, + "value": 2.0, + "raw": "2" + } + } + ] + } + }, + { + "spread": { + "start": 256, + "end": 259, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 259, + "end": 265, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 260, + "end": 261, + "ctxt": 0 + }, + "value": 3.0, + "raw": "3" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 263, + "end": 264, + "ctxt": 0 + }, + "value": 4.0, + "raw": "4" + } + } + ] + } + }, + { + "spread": { + "start": 267, + "end": 270, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 270, + "end": 276, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 271, + "end": 272, + "ctxt": 0 + }, + "value": 5.0, + "raw": "5" + } + }, + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 274, + "end": 275, + "ctxt": 0 + }, + "value": 6.0, + "raw": "6" + } + } + ] + } + } + ], + "typeArguments": null + } + }, + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 297, + "end": 299, + "ctxt": 0 + }, + "value": "f2", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 321, + "end": 331, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "RestElement", + "span": { + "start": 321, + "end": 331, + "ctxt": 0 + }, + "rest": { + "start": 321, + "end": 324, + "ctxt": 0 + }, + "argument": { + "type": "Identifier", + "span": { + "start": 324, + "end": 328, + "ctxt": 0 + }, + "value": "args", + "optional": false, + "typeAnnotation": null + }, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 328, + "end": 331, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 330, + "end": 331, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 330, + "end": 331, + "ctxt": 0 + }, + "value": "T", + "optional": false + }, + "typeParams": null + } + } + } + } + ], + "decorators": [], + "span": { + "start": 280, + "end": 336, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 299, + "end": 320, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 300, + "end": 319, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 300, + "end": 301, + "ctxt": 0 + }, + "value": "T", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsArrayType", + "span": { + "start": 310, + "end": 319, + "ctxt": 0 + }, + "elemType": { + "type": "TsKeywordType", + "span": { + "start": 310, + "end": 317, + "ctxt": 0 + }, + "kind": "unknown" + } + }, + "default": null + } + ] + }, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 332, + "end": 335, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 334, + "end": 335, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 334, + "end": 335, + "ctxt": 0 + }, + "value": "T", + "optional": false + }, + "typeParams": null + } + } + }, + { + "type": "VariableDeclaration", + "span": { + "start": 337, + "end": 366, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 343, + "end": 366, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 343, + "end": 346, + "ctxt": 0 + }, + "value": "x21", + "optional": false, + "typeAnnotation": null + }, + "init": { + "type": "CallExpression", + "span": { + "start": 349, + "end": 366, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 349, + "end": 351, + "ctxt": 0 + }, + "value": "f2", + "optional": false + }, + "arguments": [ + { + "spread": { + "start": 352, + "end": 355, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 355, + "end": 365, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 356, + "end": 357, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + } + }, + { + "spread": null, + "expression": { + "type": "StringLiteral", + "span": { + "start": 359, + "end": 364, + "ctxt": 0 + }, + "value": "foo", + "raw": "'foo'" + } + } + ] + } + } + ], + "typeArguments": null + }, + "definite": false + } + ] + }, + { + "type": "VariableDeclaration", + "span": { + "start": 367, + "end": 402, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 373, + "end": 402, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 373, + "end": 376, + "ctxt": 0 + }, + "value": "x22", + "optional": false, + "typeAnnotation": null + }, + "init": { + "type": "CallExpression", + "span": { + "start": 379, + "end": 402, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 379, + "end": 381, + "ctxt": 0 + }, + "value": "f2", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "BooleanLiteral", + "span": { + "start": 382, + "end": 386, + "ctxt": 0 + }, + "value": true + } + }, + { + "spread": { + "start": 388, + "end": 391, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 391, + "end": 401, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 392, + "end": 393, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + } + }, + { + "spread": null, + "expression": { + "type": "StringLiteral", + "span": { + "start": 395, + "end": 400, + "ctxt": 0 + }, + "value": "foo", + "raw": "'foo'" + } + } + ] + } + } + ], + "typeArguments": null + }, + "definite": false + } + ] + }, + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 421, + "end": 423, + "ctxt": 0 + }, + "value": "f3", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 454, + "end": 464, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "RestElement", + "span": { + "start": 454, + "end": 464, + "ctxt": 0 + }, + "rest": { + "start": 454, + "end": 457, + "ctxt": 0 + }, + "argument": { + "type": "Identifier", + "span": { + "start": 457, + "end": 461, + "ctxt": 0 + }, + "value": "args", + "optional": false, + "typeAnnotation": null + }, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 461, + "end": 464, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 463, + "end": 464, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 463, + "end": 464, + "ctxt": 0 + }, + "value": "T", + "optional": false + }, + "typeParams": null + } + } + } + } + ], + "decorators": [], + "span": { + "start": 404, + "end": 469, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 423, + "end": 453, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 424, + "end": 452, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 424, + "end": 425, + "ctxt": 0 + }, + "value": "T", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsTypeOperator", + "span": { + "start": 434, + "end": 452, + "ctxt": 0 + }, + "op": "readonly", + "typeAnnotation": { + "type": "TsArrayType", + "span": { + "start": 443, + "end": 452, + "ctxt": 0 + }, + "elemType": { + "type": "TsKeywordType", + "span": { + "start": 443, + "end": 450, + "ctxt": 0 + }, + "kind": "unknown" + } + } + }, + "default": null + } + ] + }, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 465, + "end": 468, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 467, + "end": 468, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 467, + "end": 468, + "ctxt": 0 + }, + "value": "T", + "optional": false + }, + "typeParams": null + } + } + }, + { + "type": "VariableDeclaration", + "span": { + "start": 470, + "end": 499, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 476, + "end": 499, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 476, + "end": 479, + "ctxt": 0 + }, + "value": "x31", + "optional": false, + "typeAnnotation": null + }, + "init": { + "type": "CallExpression", + "span": { + "start": 482, + "end": 499, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 482, + "end": 484, + "ctxt": 0 + }, + "value": "f3", + "optional": false + }, + "arguments": [ + { + "spread": { + "start": 485, + "end": 488, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 488, + "end": 498, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 489, + "end": 490, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + } + }, + { + "spread": null, + "expression": { + "type": "StringLiteral", + "span": { + "start": 492, + "end": 497, + "ctxt": 0 + }, + "value": "foo", + "raw": "'foo'" + } + } + ] + } + } + ], + "typeArguments": null + }, + "definite": false + } + ] + }, + { + "type": "VariableDeclaration", + "span": { + "start": 500, + "end": 535, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 506, + "end": 535, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 506, + "end": 509, + "ctxt": 0 + }, + "value": "x32", + "optional": false, + "typeAnnotation": null + }, + "init": { + "type": "CallExpression", + "span": { + "start": 512, + "end": 535, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 512, + "end": 514, + "ctxt": 0 + }, + "value": "f3", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "BooleanLiteral", + "span": { + "start": 515, + "end": 519, + "ctxt": 0 + }, + "value": true + } + }, + { + "spread": { + "start": 521, + "end": 524, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 524, + "end": 534, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 525, + "end": 526, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + } + }, + { + "spread": null, + "expression": { + "type": "StringLiteral", + "span": { + "start": 528, + "end": 533, + "ctxt": 0 + }, + "value": "foo", + "raw": "'foo'" + } + } + ] + } + } + ], + "typeArguments": null + }, + "definite": false + } + ] + }, + { + "type": "TsInterfaceDeclaration", + "span": { + "start": 584, + "end": 640, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 594, + "end": 601, + "ctxt": 0 + }, + "value": "IAction", + "optional": false + }, + "declare": false, + "typeParams": null, + "extends": [], + "body": { + "type": "TsInterfaceBody", + "span": { + "start": 602, + "end": 640, + "ctxt": 0 + }, + "body": [ + { + "type": "TsMethodSignature", + "span": { + "start": 608, + "end": 638, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 608, + "end": 611, + "ctxt": 0 + }, + "value": "run", + "optional": false + }, + "computed": false, + "optional": false, + "params": [ + { + "type": "Identifier", + "span": { + "start": 612, + "end": 627, + "ctxt": 0 + }, + "value": "event", + "optional": true, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 618, + "end": 627, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 620, + "end": 627, + "ctxt": 0 + }, + "kind": "unknown" + } + } + } + ], + "typeAnn": { + "type": "TsTypeAnnotation", + "span": { + "start": 628, + "end": 637, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 630, + "end": 637, + "ctxt": 0 + }, + "kind": "unknown" + } + }, + "typeParams": null + } + ] + } + }, + { + "type": "VariableDeclaration", + "span": { + "start": 641, + "end": 670, + "ctxt": 0 + }, + "kind": "const", + "declare": true, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 655, + "end": 670, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 655, + "end": 661, + "ctxt": 0 + }, + "value": "action", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 661, + "end": 670, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 663, + "end": 670, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 663, + "end": 670, + "ctxt": 0 + }, + "value": "IAction", + "optional": false + }, + "typeParams": null + } + } + }, + "init": null, + "definite": false + } + ] + }, + { + "type": "ExpressionStatement", + "span": { + "start": 671, + "end": 698, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 671, + "end": 698, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 671, + "end": 681, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 671, + "end": 677, + "ctxt": 0 + }, + "value": "action", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 678, + "end": 681, + "ctxt": 0 + }, + "value": "run", + "optional": false + } + }, + "arguments": [ + { + "spread": { + "start": 682, + "end": 685, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 685, + "end": 697, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "NumericLiteral", + "span": { + "start": 686, + "end": 689, + "ctxt": 0 + }, + "value": 100.0, + "raw": "100" + } + }, + { + "spread": null, + "expression": { + "type": "StringLiteral", + "span": { + "start": 691, + "end": 696, + "ctxt": 0 + }, + "value": "foo", + "raw": "'foo'" + } + } + ] + } + } + ], + "typeArguments": null + } + } + ], + "interpreter": null +} diff --git a/crates/swc_ecma_parser/tests/tsc/arraySpreadInCall.ts b/crates/swc_ecma_parser/tests/tsc/arraySpreadInCall.ts new file mode 100644 index 000000000000..9077256106ba --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/arraySpreadInCall.ts @@ -0,0 +1,25 @@ +// @strict: true +// @noEmit: true + +declare function f1(a: number, b: number, c: number, d: number, e: number, f: number): void; +f1(1, 2, 3, 4, ...[5, 6]); +f1(...[1], 2, 3, 4, 5, 6); +f1(1, 2, ...[3, 4], 5, 6); +f1(1, 2, ...[3], 4, ...[5, 6]); +f1(...[1, 2], ...[3, 4], ...[5, 6]); + +declare function f2(...args: T): T; +const x21 = f2(...[1, 'foo']) +const x22 = f2(true, ...[1, 'foo']) + +declare function f3(...args: T): T; +const x31 = f3(...[1, 'foo']) +const x32 = f3(true, ...[1, 'foo']) + +// dicovered in #52845#issuecomment-1459132562 +interface IAction { + run(event?: unknown): unknown; +} +declare const action: IAction +action.run(...[100, 'foo']) // error + diff --git a/crates/swc_ecma_parser/tests/tsc/bundlerSyntaxRestrictions.json b/crates/swc_ecma_parser/tests/tsc/bundlerSyntaxRestrictions.json index a6973369031e..583bcd68cd42 100644 --- a/crates/swc_ecma_parser/tests/tsc/bundlerSyntaxRestrictions.json +++ b/crates/swc_ecma_parser/tests/tsc/bundlerSyntaxRestrictions.json @@ -1,16 +1,16 @@ { "type": "Module", "span": { - "start": 135, - "end": 733, + "start": 154, + "end": 752, "ctxt": 0 }, "body": [ { "type": "VariableDeclaration", "span": { - "start": 135, - "end": 180, + "start": 154, + "end": 199, "ctxt": 0 }, "kind": "var", @@ -19,15 +19,15 @@ { "type": "VariableDeclarator", "span": { - "start": 147, - "end": 179, + "start": 166, + "end": 198, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 147, - "end": 154, + "start": 166, + "end": 173, "ctxt": 0 }, "value": "require", @@ -35,35 +35,35 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 154, - "end": 179, + "start": 173, + "end": 198, "ctxt": 0 }, "typeAnnotation": { "type": "TsFunctionType", "span": { - "start": 156, - "end": 179, + "start": 175, + "end": 198, "ctxt": 0 }, "params": [ { "type": "RestElement", "span": { - "start": 157, - "end": 171, + "start": 176, + "end": 190, "ctxt": 0 }, "rest": { - "start": 157, - "end": 160, + "start": 176, + "end": 179, "ctxt": 0 }, "argument": { "type": "Identifier", "span": { - "start": 160, - "end": 164, + "start": 179, + "end": 183, "ctxt": 0 }, "value": "args", @@ -73,22 +73,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 164, - "end": 171, + "start": 183, + "end": 190, "ctxt": 0 }, "typeAnnotation": { "type": "TsArrayType", "span": { - "start": 166, - "end": 171, + "start": 185, + "end": 190, "ctxt": 0 }, "elemType": { "type": "TsKeywordType", "span": { - "start": 166, - "end": 169, + "start": 185, + "end": 188, "ctxt": 0 }, "kind": "any" @@ -101,15 +101,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 173, - "end": 179, + "start": 192, + "end": 198, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 176, - "end": 179, + "start": 195, + "end": 198, "ctxt": 0 }, "kind": "any" @@ -126,8 +126,8 @@ { "type": "TsModuleDeclaration", "span": { - "start": 210, - "end": 308, + "start": 229, + "end": 327, "ctxt": 0 }, "declare": true, @@ -135,8 +135,8 @@ "id": { "type": "StringLiteral", "span": { - "start": 225, - "end": 229, + "start": 244, + "end": 248, "ctxt": 0 }, "value": "fs", @@ -145,16 +145,16 @@ "body": { "type": "TsModuleBlock", "span": { - "start": 230, - "end": 308, + "start": 249, + "end": 327, "ctxt": 0 }, "body": [ { "type": "ExportDeclaration", "span": { - "start": 236, - "end": 306, + "start": 255, + "end": 325, "ctxt": 0 }, "declaration": { @@ -162,8 +162,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 252, - "end": 264, + "start": 271, + "end": 283, "ctxt": 0 }, "value": "readFileSync", @@ -174,16 +174,16 @@ { "type": "Parameter", "span": { - "start": 265, - "end": 277, + "start": 284, + "end": 296, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 265, - "end": 277, + "start": 284, + "end": 296, "ctxt": 0 }, "value": "path", @@ -191,15 +191,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 269, - "end": 277, + "start": 288, + "end": 296, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 271, - "end": 277, + "start": 290, + "end": 296, "ctxt": 0 }, "kind": "string" @@ -210,16 +210,16 @@ { "type": "Parameter", "span": { - "start": 279, - "end": 296, + "start": 298, + "end": 315, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 279, - "end": 296, + "start": 298, + "end": 315, "ctxt": 0 }, "value": "encoding", @@ -227,15 +227,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 288, - "end": 296, + "start": 307, + "end": 315, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 290, - "end": 296, + "start": 309, + "end": 315, "ctxt": 0 }, "kind": "string" @@ -246,8 +246,8 @@ ], "decorators": [], "span": { - "start": 243, - "end": 306, + "start": 262, + "end": 325, "ctxt": 0 }, "body": null, @@ -257,15 +257,15 @@ "returnType": { "type": "TsTypeAnnotation", "span": { - "start": 297, - "end": 305, + "start": 316, + "end": 324, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 299, - "end": 305, + "start": 318, + "end": 324, "ctxt": 0 }, "kind": "string" @@ -279,8 +279,8 @@ { "type": "TsModuleDeclaration", "span": { - "start": 309, - "end": 457, + "start": 328, + "end": 476, "ctxt": 0 }, "declare": true, @@ -288,8 +288,8 @@ "id": { "type": "StringLiteral", "span": { - "start": 324, - "end": 330, + "start": 343, + "end": 349, "ctxt": 0 }, "value": "path", @@ -298,16 +298,16 @@ "body": { "type": "TsModuleBlock", "span": { - "start": 331, - "end": 457, + "start": 350, + "end": 476, "ctxt": 0 }, "body": [ { "type": "TsImportEqualsDeclaration", "span": { - "start": 337, - "end": 363, + "start": 356, + "end": 382, "ctxt": 0 }, "declare": false, @@ -316,8 +316,8 @@ "id": { "type": "Identifier", "span": { - "start": 344, - "end": 346, + "start": 363, + "end": 365, "ctxt": 0 }, "value": "fs", @@ -326,15 +326,15 @@ "moduleRef": { "type": "TsExternalModuleReference", "span": { - "start": 349, - "end": 362, + "start": 368, + "end": 381, "ctxt": 0 }, "expression": { "type": "StringLiteral", "span": { - "start": 357, - "end": 361, + "start": 376, + "end": 380, "ctxt": 0 }, "value": "fs", @@ -345,8 +345,8 @@ { "type": "TsModuleDeclaration", "span": { - "start": 374, - "end": 430, + "start": 393, + "end": 449, "ctxt": 0 }, "declare": false, @@ -354,8 +354,8 @@ "id": { "type": "Identifier", "span": { - "start": 384, - "end": 388, + "start": 403, + "end": 407, "ctxt": 0 }, "value": "path", @@ -364,23 +364,23 @@ "body": { "type": "TsModuleBlock", "span": { - "start": 389, - "end": 430, + "start": 408, + "end": 449, "ctxt": 0 }, "body": [ { "type": "ExportDeclaration", "span": { - "start": 399, - "end": 424, + "start": 418, + "end": 443, "ctxt": 0 }, "declaration": { "type": "VariableDeclaration", "span": { - "start": 406, - "end": 424, + "start": 425, + "end": 443, "ctxt": 0 }, "kind": "const", @@ -389,15 +389,15 @@ { "type": "VariableDeclarator", "span": { - "start": 412, - "end": 423, + "start": 431, + "end": 442, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 412, - "end": 415, + "start": 431, + "end": 434, "ctxt": 0 }, "value": "sep", @@ -405,15 +405,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 415, - "end": 423, + "start": 434, + "end": 442, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 417, - "end": 423, + "start": 436, + "end": 442, "ctxt": 0 }, "kind": "string" @@ -432,15 +432,15 @@ { "type": "TsExportAssignment", "span": { - "start": 435, - "end": 449, + "start": 454, + "end": 468, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 444, - "end": 448, + "start": 463, + "end": 467, "ctxt": 0 }, "value": "path", @@ -453,16 +453,16 @@ { "type": "ImportDeclaration", "span": { - "start": 484, - "end": 505, + "start": 503, + "end": 524, "ctxt": 0 }, "specifiers": [], "source": { "type": "StringLiteral", "span": { - "start": 499, - "end": 504, + "start": 518, + "end": 523, "ctxt": 0 }, "value": "./a", @@ -474,22 +474,22 @@ { "type": "ExpressionStatement", "span": { - "start": 506, - "end": 520, + "start": 525, + "end": 539, "ctxt": 0 }, "expression": { "type": "CallExpression", "span": { - "start": 506, - "end": 519, + "start": 525, + "end": 538, "ctxt": 0 }, "callee": { "type": "Import", "span": { - "start": 506, - "end": 512, + "start": 525, + "end": 531, "ctxt": 0 } }, @@ -499,8 +499,8 @@ "expression": { "type": "StringLiteral", "span": { - "start": 513, - "end": 518, + "start": 532, + "end": 537, "ctxt": 0 }, "value": "./a", @@ -514,8 +514,8 @@ { "type": "VariableDeclaration", "span": { - "start": 521, - "end": 546, + "start": 540, + "end": 565, "ctxt": 0 }, "kind": "const", @@ -524,15 +524,15 @@ { "type": "VariableDeclarator", "span": { - "start": 527, - "end": 545, + "start": 546, + "end": 564, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 527, - "end": 528, + "start": 546, + "end": 547, "ctxt": 0 }, "value": "_", @@ -542,15 +542,15 @@ "init": { "type": "CallExpression", "span": { - "start": 531, - "end": 545, + "start": 550, + "end": 564, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 531, - "end": 538, + "start": 550, + "end": 557, "ctxt": 0 }, "value": "require", @@ -562,8 +562,8 @@ "expression": { "type": "StringLiteral", "span": { - "start": 539, - "end": 544, + "start": 558, + "end": 563, "ctxt": 0 }, "value": "./a", @@ -580,22 +580,22 @@ { "type": "ExpressionStatement", "span": { - "start": 564, - "end": 568, + "start": 583, + "end": 587, "ctxt": 0 }, "expression": { "type": "MemberExpression", "span": { - "start": 564, - "end": 567, + "start": 583, + "end": 586, "ctxt": 0 }, "object": { "type": "Identifier", "span": { - "start": 564, - "end": 565, + "start": 583, + "end": 584, "ctxt": 0 }, "value": "_", @@ -604,8 +604,8 @@ "property": { "type": "Identifier", "span": { - "start": 566, - "end": 567, + "start": 585, + "end": 586, "ctxt": 0 }, "value": "a", @@ -616,16 +616,16 @@ { "type": "ImportDeclaration", "span": { - "start": 600, - "end": 621, + "start": 619, + "end": 640, "ctxt": 0 }, "specifiers": [], "source": { "type": "StringLiteral", "span": { - "start": 615, - "end": 620, + "start": 634, + "end": 639, "ctxt": 0 }, "value": "./a", @@ -637,8 +637,8 @@ { "type": "TsImportEqualsDeclaration", "span": { - "start": 622, - "end": 648, + "start": 641, + "end": 667, "ctxt": 0 }, "declare": false, @@ -647,8 +647,8 @@ "id": { "type": "Identifier", "span": { - "start": 629, - "end": 630, + "start": 648, + "end": 649, "ctxt": 0 }, "value": "_", @@ -657,15 +657,15 @@ "moduleRef": { "type": "TsExternalModuleReference", "span": { - "start": 633, - "end": 647, + "start": 652, + "end": 666, "ctxt": 0 }, "expression": { "type": "StringLiteral", "span": { - "start": 641, - "end": 646, + "start": 660, + "end": 665, "ctxt": 0 }, "value": "./a", @@ -676,15 +676,15 @@ { "type": "TsExportAssignment", "span": { - "start": 658, - "end": 670, + "start": 677, + "end": 689, "ctxt": 0 }, "expression": { "type": "ObjectExpression", "span": { - "start": 667, - "end": 669, + "start": 686, + "end": 688, "ctxt": 0 }, "properties": [] @@ -693,8 +693,8 @@ { "type": "ExportNamedDeclaration", "span": { - "start": 680, - "end": 690, + "start": 699, + "end": 709, "ctxt": 0 }, "specifiers": [], @@ -705,15 +705,15 @@ { "type": "ExportDeclaration", "span": { - "start": 712, - "end": 733, + "start": 731, + "end": 752, "ctxt": 0 }, "declaration": { "type": "VariableDeclaration", "span": { - "start": 719, - "end": 733, + "start": 738, + "end": 752, "ctxt": 0 }, "kind": "const", @@ -722,15 +722,15 @@ { "type": "VariableDeclarator", "span": { - "start": 725, - "end": 732, + "start": 744, + "end": 751, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 725, - "end": 726, + "start": 744, + "end": 745, "ctxt": 0 }, "value": "a", @@ -740,8 +740,8 @@ "init": { "type": "StringLiteral", "span": { - "start": 729, - "end": 732, + "start": 748, + "end": 751, "ctxt": 0 }, "value": "a", diff --git a/crates/swc_ecma_parser/tests/tsc/bundlerSyntaxRestrictions.ts b/crates/swc_ecma_parser/tests/tsc/bundlerSyntaxRestrictions.ts index 5bdd94d1beff..e71313bca4cf 100644 --- a/crates/swc_ecma_parser/tests/tsc/bundlerSyntaxRestrictions.ts +++ b/crates/swc_ecma_parser/tests/tsc/bundlerSyntaxRestrictions.ts @@ -1,4 +1,5 @@ // @moduleResolution: bundler +// @module: esnext // @checkJs: true // @allowJs: true // @outDir: out diff --git a/crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty16.tsx b/crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty16.tsx new file mode 100644 index 000000000000..cf1f81f4bac2 --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty16.tsx @@ -0,0 +1,30 @@ +// @strict: true +// @noEmit: true +// @jsx: preserve + +/// + +// repro from #53493 + +import React = require('react'); + +export type Props = + | { renderNumber?: false; children: (arg: string) => void } + | { + renderNumber: true; + children: (arg: number) => void; + }; + +export declare function Foo(props: Props): JSX.Element; + +export const Test = () => { + return ( + <> + {(value) => {}} + {(value) => {}} + + {}} /> + {}} /> + + ); +}; \ No newline at end of file diff --git a/crates/swc_ecma_parser/tests/tsc/contextualTypeTupleEnd.json b/crates/swc_ecma_parser/tests/tsc/contextualTypeTupleEnd.json new file mode 100644 index 000000000000..48c49d5c6fce --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/contextualTypeTupleEnd.json @@ -0,0 +1,3320 @@ +{ + "type": "Module", + "span": { + "start": 36, + "end": 1262, + "ctxt": 0 + }, + "body": [ + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 36, + "end": 103, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 41, + "end": 46, + "ctxt": 0 + }, + "value": "Funcs", + "optional": false + }, + "typeParams": null, + "typeAnnotation": { + "type": "TsTupleType", + "span": { + "start": 49, + "end": 102, + "ctxt": 0 + }, + "elemTypes": [ + { + "type": "TsTupleElement", + "span": { + "start": 50, + "end": 78, + "ctxt": 0 + }, + "label": null, + "ty": { + "type": "TsRestType", + "span": { + "start": 50, + "end": 78, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsArrayType", + "span": { + "start": 53, + "end": 78, + "ctxt": 0 + }, + "elemType": { + "type": "TsParenthesizedType", + "span": { + "start": 53, + "end": 76, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsFunctionType", + "span": { + "start": 54, + "end": 75, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 55, + "end": 66, + "ctxt": 0 + }, + "value": "arg", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 58, + "end": 66, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 60, + "end": 66, + "ctxt": 0 + }, + "kind": "number" + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 68, + "end": 75, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 71, + "end": 75, + "ctxt": 0 + }, + "kind": "void" + } + } + } + } + } + } + }, + { + "type": "TsTupleElement", + "span": { + "start": 80, + "end": 101, + "ctxt": 0 + }, + "label": null, + "ty": { + "type": "TsFunctionType", + "span": { + "start": 80, + "end": 101, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 81, + "end": 92, + "ctxt": 0 + }, + "value": "arg", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 84, + "end": 92, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 86, + "end": 92, + "ctxt": 0 + }, + "kind": "string" + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 94, + "end": 101, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 97, + "end": 101, + "ctxt": 0 + }, + "kind": "void" + } + } + } + } + ] + } + }, + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 122, + "end": 125, + "ctxt": 0 + }, + "value": "num", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 126, + "end": 135, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 126, + "end": 135, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 127, + "end": 135, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 129, + "end": 135, + "ctxt": 0 + }, + "kind": "number" + } + } + } + } + ], + "decorators": [], + "span": { + "start": 105, + "end": 143, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 136, + "end": 142, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 138, + "end": 142, + "ctxt": 0 + }, + "kind": "void" + } + } + }, + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 161, + "end": 164, + "ctxt": 0 + }, + "value": "str", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 165, + "end": 174, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 165, + "end": 174, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 166, + "end": 174, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 168, + "end": 174, + "ctxt": 0 + }, + "kind": "string" + } + } + } + } + ], + "decorators": [], + "span": { + "start": 144, + "end": 182, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 175, + "end": 181, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 177, + "end": 181, + "ctxt": 0 + }, + "kind": "void" + } + } + }, + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 201, + "end": 203, + "ctxt": 0 + }, + "value": "f1", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 204, + "end": 218, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "RestElement", + "span": { + "start": 204, + "end": 218, + "ctxt": 0 + }, + "rest": { + "start": 204, + "end": 207, + "ctxt": 0 + }, + "argument": { + "type": "Identifier", + "span": { + "start": 207, + "end": 211, + "ctxt": 0 + }, + "value": "args", + "optional": false, + "typeAnnotation": null + }, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 211, + "end": 218, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 213, + "end": 218, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 213, + "end": 218, + "ctxt": 0 + }, + "value": "Funcs", + "optional": false + }, + "typeParams": null + } + } + } + } + ], + "decorators": [], + "span": { + "start": 184, + "end": 226, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 219, + "end": 225, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 221, + "end": 225, + "ctxt": 0 + }, + "kind": "void" + } + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 228, + "end": 233, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 228, + "end": 232, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 228, + "end": 230, + "ctxt": 0 + }, + "value": "f1", + "optional": false + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 244, + "end": 260, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 244, + "end": 259, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 244, + "end": 246, + "ctxt": 0 + }, + "value": "f1", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 247, + "end": 258, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 247, + "end": 248, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "CallExpression", + "span": { + "start": 252, + "end": 258, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 252, + "end": 255, + "ctxt": 0 + }, + "value": "str", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 256, + "end": 257, + "ctxt": 0 + }, + "value": "x", + "optional": false + } + } + ], + "typeArguments": null + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + } + ], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 261, + "end": 290, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 261, + "end": 289, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 261, + "end": 263, + "ctxt": 0 + }, + "value": "f1", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 264, + "end": 275, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 264, + "end": 265, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "CallExpression", + "span": { + "start": 269, + "end": 275, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 269, + "end": 272, + "ctxt": 0 + }, + "value": "num", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 273, + "end": 274, + "ctxt": 0 + }, + "value": "x", + "optional": false + } + } + ], + "typeArguments": null + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + }, + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 277, + "end": 288, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 277, + "end": 278, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "CallExpression", + "span": { + "start": 282, + "end": 288, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 282, + "end": 285, + "ctxt": 0 + }, + "value": "str", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 286, + "end": 287, + "ctxt": 0 + }, + "value": "x", + "optional": false + } + } + ], + "typeArguments": null + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + } + ], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 291, + "end": 333, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 291, + "end": 332, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 291, + "end": 293, + "ctxt": 0 + }, + "value": "f1", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 294, + "end": 305, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 294, + "end": 295, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "CallExpression", + "span": { + "start": 299, + "end": 305, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 299, + "end": 302, + "ctxt": 0 + }, + "value": "num", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 303, + "end": 304, + "ctxt": 0 + }, + "value": "x", + "optional": false + } + } + ], + "typeArguments": null + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + }, + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 307, + "end": 318, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 307, + "end": 308, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "CallExpression", + "span": { + "start": 312, + "end": 318, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 312, + "end": 315, + "ctxt": 0 + }, + "value": "num", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 316, + "end": 317, + "ctxt": 0 + }, + "value": "x", + "optional": false + } + } + ], + "typeArguments": null + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + }, + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 320, + "end": 331, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 320, + "end": 321, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "CallExpression", + "span": { + "start": 325, + "end": 331, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 325, + "end": 328, + "ctxt": 0 + }, + "value": "str", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 329, + "end": 330, + "ctxt": 0 + }, + "value": "x", + "optional": false + } + } + ], + "typeArguments": null + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + } + ], + "typeArguments": null + } + }, + { + "type": "VariableDeclaration", + "span": { + "start": 335, + "end": 356, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 341, + "end": 355, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 341, + "end": 343, + "ctxt": 0 + }, + "value": "a0", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 343, + "end": 350, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 345, + "end": 350, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 345, + "end": 350, + "ctxt": 0 + }, + "value": "Funcs", + "optional": false + }, + "typeParams": null + } + } + }, + "init": { + "type": "ArrayExpression", + "span": { + "start": 353, + "end": 355, + "ctxt": 0 + }, + "elements": [] + }, + "definite": false + } + ] + }, + { + "type": "VariableDeclaration", + "span": { + "start": 367, + "end": 399, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 373, + "end": 398, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 373, + "end": 375, + "ctxt": 0 + }, + "value": "a1", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 375, + "end": 382, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 377, + "end": 382, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 377, + "end": 382, + "ctxt": 0 + }, + "value": "Funcs", + "optional": false + }, + "typeParams": null + } + } + }, + "init": { + "type": "ArrayExpression", + "span": { + "start": 385, + "end": 398, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 386, + "end": 397, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 386, + "end": 387, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "CallExpression", + "span": { + "start": 391, + "end": 397, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 391, + "end": 394, + "ctxt": 0 + }, + "value": "str", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 395, + "end": 396, + "ctxt": 0 + }, + "value": "x", + "optional": false + } + } + ], + "typeArguments": null + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + } + ] + }, + "definite": false + } + ] + }, + { + "type": "VariableDeclaration", + "span": { + "start": 400, + "end": 445, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 406, + "end": 444, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 406, + "end": 408, + "ctxt": 0 + }, + "value": "a2", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 408, + "end": 415, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 410, + "end": 415, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 410, + "end": 415, + "ctxt": 0 + }, + "value": "Funcs", + "optional": false + }, + "typeParams": null + } + } + }, + "init": { + "type": "ArrayExpression", + "span": { + "start": 418, + "end": 444, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 419, + "end": 430, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 419, + "end": 420, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "CallExpression", + "span": { + "start": 424, + "end": 430, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 424, + "end": 427, + "ctxt": 0 + }, + "value": "num", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 428, + "end": 429, + "ctxt": 0 + }, + "value": "x", + "optional": false + } + } + ], + "typeArguments": null + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + }, + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 432, + "end": 443, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 432, + "end": 433, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "CallExpression", + "span": { + "start": 437, + "end": 443, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 437, + "end": 440, + "ctxt": 0 + }, + "value": "str", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 441, + "end": 442, + "ctxt": 0 + }, + "value": "x", + "optional": false + } + } + ], + "typeArguments": null + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + } + ] + }, + "definite": false + } + ] + }, + { + "type": "VariableDeclaration", + "span": { + "start": 446, + "end": 504, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 452, + "end": 503, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 452, + "end": 454, + "ctxt": 0 + }, + "value": "a3", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 454, + "end": 461, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 456, + "end": 461, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 456, + "end": 461, + "ctxt": 0 + }, + "value": "Funcs", + "optional": false + }, + "typeParams": null + } + } + }, + "init": { + "type": "ArrayExpression", + "span": { + "start": 464, + "end": 503, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 465, + "end": 476, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 465, + "end": 466, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "CallExpression", + "span": { + "start": 470, + "end": 476, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 470, + "end": 473, + "ctxt": 0 + }, + "value": "num", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 474, + "end": 475, + "ctxt": 0 + }, + "value": "x", + "optional": false + } + } + ], + "typeArguments": null + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + }, + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 478, + "end": 489, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 478, + "end": 479, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "CallExpression", + "span": { + "start": 483, + "end": 489, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 483, + "end": 486, + "ctxt": 0 + }, + "value": "num", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 487, + "end": 488, + "ctxt": 0 + }, + "value": "x", + "optional": false + } + } + ], + "typeArguments": null + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + }, + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 491, + "end": 502, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 491, + "end": 492, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "CallExpression", + "span": { + "start": 496, + "end": 502, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 496, + "end": 499, + "ctxt": 0 + }, + "value": "str", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 500, + "end": 501, + "ctxt": 0 + }, + "value": "x", + "optional": false + } + } + ], + "typeArguments": null + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + } + ] + }, + "definite": false + } + ] + }, + { + "type": "ExportDeclaration", + "span": { + "start": 528, + "end": 584, + "ctxt": 0 + }, + "declaration": { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 535, + "end": 584, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 540, + "end": 548, + "ctxt": 0 + }, + "value": "Selector", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 548, + "end": 555, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 549, + "end": 554, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 549, + "end": 554, + "ctxt": 0 + }, + "value": "State", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsFunctionType", + "span": { + "start": 558, + "end": 583, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 559, + "end": 571, + "ctxt": 0 + }, + "value": "state", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 564, + "end": 571, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 566, + "end": 571, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 566, + "end": 571, + "ctxt": 0 + }, + "value": "State", + "optional": false + }, + "typeParams": null + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 573, + "end": 583, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 576, + "end": 583, + "ctxt": 0 + }, + "kind": "unknown" + } + } + } + } + }, + { + "type": "ExportDeclaration", + "span": { + "start": 585, + "end": 638, + "ctxt": 0 + }, + "declaration": { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 592, + "end": 638, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 597, + "end": 610, + "ctxt": 0 + }, + "value": "SelectorTuple", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 610, + "end": 617, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 611, + "end": 616, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 611, + "end": 616, + "ctxt": 0 + }, + "value": "State", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsArrayType", + "span": { + "start": 620, + "end": 637, + "ctxt": 0 + }, + "elemType": { + "type": "TsTypeReference", + "span": { + "start": 620, + "end": 635, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 620, + "end": 628, + "ctxt": 0 + }, + "value": "Selector", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 628, + "end": 635, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 629, + "end": 634, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 629, + "end": 634, + "ctxt": 0 + }, + "value": "State", + "optional": false + }, + "typeParams": null + } + ] + } + } + } + } + }, + { + "type": "ExportDeclaration", + "span": { + "start": 640, + "end": 700, + "ctxt": 0 + }, + "declaration": { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 647, + "end": 700, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 652, + "end": 664, + "ctxt": 0 + }, + "value": "ExampleState", + "optional": false + }, + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeLiteral", + "span": { + "start": 667, + "end": 699, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 673, + "end": 684, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 673, + "end": 676, + "ctxt": 0 + }, + "value": "foo", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 676, + "end": 683, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsLiteralType", + "span": { + "start": 678, + "end": 683, + "ctxt": 0 + }, + "literal": { + "type": "StringLiteral", + "span": { + "start": 678, + "end": 683, + "ctxt": 0 + }, + "value": "foo", + "raw": "\"foo\"" + } + } + }, + "typeParams": null + }, + { + "type": "TsPropertySignature", + "span": { + "start": 689, + "end": 697, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 689, + "end": 692, + "ctxt": 0 + }, + "value": "bar", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 692, + "end": 696, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsLiteralType", + "span": { + "start": 694, + "end": 696, + "ctxt": 0 + }, + "literal": { + "type": "NumericLiteral", + "span": { + "start": 694, + "end": 696, + "ctxt": 0 + }, + "value": 42.0, + "raw": "42" + } + } + }, + "typeParams": null + } + ] + } + } + }, + { + "type": "ExportDeclaration", + "span": { + "start": 702, + "end": 856, + "ctxt": 0 + }, + "declaration": { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 718, + "end": 732, + "ctxt": 0 + }, + "value": "createSelector", + "optional": false + }, + "declare": false, + "params": [ + { + "type": "Parameter", + "span": { + "start": 772, + "end": 823, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "RestElement", + "span": { + "start": 772, + "end": 823, + "ctxt": 0 + }, + "rest": { + "start": 772, + "end": 775, + "ctxt": 0 + }, + "argument": { + "type": "Identifier", + "span": { + "start": 775, + "end": 784, + "ctxt": 0 + }, + "value": "selectors", + "optional": false, + "typeAnnotation": null + }, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 784, + "end": 823, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTupleType", + "span": { + "start": 786, + "end": 823, + "ctxt": 0 + }, + "elemTypes": [ + { + "type": "TsTupleElement", + "span": { + "start": 787, + "end": 802, + "ctxt": 0 + }, + "label": { + "type": "RestElement", + "span": { + "start": 787, + "end": 800, + "ctxt": 0 + }, + "rest": { + "start": 787, + "end": 790, + "ctxt": 0 + }, + "argument": { + "type": "Identifier", + "span": { + "start": 790, + "end": 799, + "ctxt": 0 + }, + "value": "selectors", + "optional": false, + "typeAnnotation": null + }, + "typeAnnotation": null + }, + "ty": { + "type": "TsTypeReference", + "span": { + "start": 801, + "end": 802, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 801, + "end": 802, + "ctxt": 0 + }, + "value": "S", + "optional": false + }, + "typeParams": null + } + }, + { + "type": "TsTupleElement", + "span": { + "start": 804, + "end": 822, + "ctxt": 0 + }, + "label": { + "type": "Identifier", + "span": { + "start": 804, + "end": 805, + "ctxt": 0 + }, + "value": "f", + "optional": false, + "typeAnnotation": null + }, + "ty": { + "type": "TsFunctionType", + "span": { + "start": 807, + "end": 822, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 808, + "end": 814, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 809, + "end": 814, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 811, + "end": 814, + "ctxt": 0 + }, + "kind": "any" + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 816, + "end": 822, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 819, + "end": 822, + "ctxt": 0 + }, + "kind": "any" + } + } + } + } + ] + } + } + } + } + ], + "decorators": [], + "span": { + "start": 709, + "end": 856, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 825, + "end": 856, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ExpressionStatement", + "span": { + "start": 831, + "end": 854, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 831, + "end": 853, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 831, + "end": 842, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 831, + "end": 838, + "ctxt": 0 + }, + "value": "console", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 839, + "end": 842, + "ctxt": 0 + }, + "value": "log", + "optional": false + } + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 843, + "end": 852, + "ctxt": 0 + }, + "value": "selectors", + "optional": false + } + } + ], + "typeArguments": null + } + } + ] + }, + "generator": false, + "async": false, + "typeParameters": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 732, + "end": 771, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 733, + "end": 770, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 733, + "end": 734, + "ctxt": 0 + }, + "value": "S", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsTypeReference", + "span": { + "start": 743, + "end": 770, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 743, + "end": 756, + "ctxt": 0 + }, + "value": "SelectorTuple", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 756, + "end": 770, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 757, + "end": 769, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 757, + "end": 769, + "ctxt": 0 + }, + "value": "ExampleState", + "optional": false + }, + "typeParams": null + } + ] + } + }, + "default": null + } + ] + }, + "returnType": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 858, + "end": 921, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 858, + "end": 920, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 858, + "end": 872, + "ctxt": 0 + }, + "value": "createSelector", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 878, + "end": 888, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 878, + "end": 879, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "MemberExpression", + "span": { + "start": 883, + "end": 888, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 883, + "end": 884, + "ctxt": 0 + }, + "value": "x", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 885, + "end": 888, + "ctxt": 0 + }, + "value": "foo", + "optional": false + } + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + }, + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 894, + "end": 904, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 894, + "end": 895, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "MemberExpression", + "span": { + "start": 899, + "end": 904, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 899, + "end": 900, + "ctxt": 0 + }, + "value": "x", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 901, + "end": 904, + "ctxt": 0 + }, + "value": "bar", + "optional": false + } + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + }, + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 910, + "end": 918, + "ctxt": 0 + }, + "params": [], + "body": { + "type": "NumericLiteral", + "span": { + "start": 916, + "end": 918, + "ctxt": 0 + }, + "value": 42.0, + "raw": "42" + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + } + ], + "typeArguments": null + } + }, + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 962, + "end": 969, + "ctxt": 0 + }, + "value": "example", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 970, + "end": 1025, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "RestElement", + "span": { + "start": 970, + "end": 1025, + "ctxt": 0 + }, + "rest": { + "start": 970, + "end": 973, + "ctxt": 0 + }, + "argument": { + "type": "Identifier", + "span": { + "start": 973, + "end": 977, + "ctxt": 0 + }, + "value": "args", + "optional": false, + "typeAnnotation": null + }, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 977, + "end": 1025, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTupleType", + "span": { + "start": 979, + "end": 1025, + "ctxt": 0 + }, + "elemTypes": [ + { + "type": "TsTupleElement", + "span": { + "start": 980, + "end": 1006, + "ctxt": 0 + }, + "label": null, + "ty": { + "type": "TsRestType", + "span": { + "start": 980, + "end": 1006, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsArrayType", + "span": { + "start": 983, + "end": 1006, + "ctxt": 0 + }, + "elemType": { + "type": "TsParenthesizedType", + "span": { + "start": 983, + "end": 1004, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsFunctionType", + "span": { + "start": 984, + "end": 1003, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 985, + "end": 994, + "ctxt": 0 + }, + "value": "n", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 986, + "end": 994, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 988, + "end": 994, + "ctxt": 0 + }, + "kind": "number" + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 996, + "end": 1003, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 999, + "end": 1003, + "ctxt": 0 + }, + "kind": "void" + } + } + } + } + } + } + }, + { + "type": "TsTupleElement", + "span": { + "start": 1008, + "end": 1024, + "ctxt": 0 + }, + "label": null, + "ty": { + "type": "TsFunctionType", + "span": { + "start": 1008, + "end": 1024, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 1009, + "end": 1015, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 1010, + "end": 1015, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 1012, + "end": 1015, + "ctxt": 0 + }, + "kind": "any" + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 1017, + "end": 1024, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 1020, + "end": 1024, + "ctxt": 0 + }, + "kind": "void" + } + } + } + } + ] + } + } + } + } + ], + "decorators": [], + "span": { + "start": 945, + "end": 1032, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 1026, + "end": 1032, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 1028, + "end": 1032, + "ctxt": 0 + }, + "kind": "void" + } + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 1034, + "end": 1113, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 1034, + "end": 1112, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 1034, + "end": 1041, + "ctxt": 0 + }, + "value": "example", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 1047, + "end": 1057, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 1047, + "end": 1048, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "MemberExpression", + "span": { + "start": 1052, + "end": 1057, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 1052, + "end": 1053, + "ctxt": 0 + }, + "value": "x", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 1054, + "end": 1057, + "ctxt": 0 + }, + "value": "foo", + "optional": false + } + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + }, + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 1073, + "end": 1083, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 1073, + "end": 1074, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "MemberExpression", + "span": { + "start": 1078, + "end": 1083, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 1078, + "end": 1079, + "ctxt": 0 + }, + "value": "x", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 1080, + "end": 1083, + "ctxt": 0 + }, + "value": "bar", + "optional": false + } + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + }, + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 1099, + "end": 1109, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 1099, + "end": 1100, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "MemberExpression", + "span": { + "start": 1104, + "end": 1109, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 1104, + "end": 1105, + "ctxt": 0 + }, + "value": "x", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 1106, + "end": 1109, + "ctxt": 0 + }, + "value": "baz", + "optional": false + } + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + } + ], + "typeArguments": null + } + }, + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 1154, + "end": 1158, + "ctxt": 0 + }, + "value": "test", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 1159, + "end": 1221, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "RestElement", + "span": { + "start": 1159, + "end": 1221, + "ctxt": 0 + }, + "rest": { + "start": 1159, + "end": 1162, + "ctxt": 0 + }, + "argument": { + "type": "Identifier", + "span": { + "start": 1162, + "end": 1166, + "ctxt": 0 + }, + "value": "args", + "optional": false, + "typeAnnotation": null + }, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 1166, + "end": 1221, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTupleType", + "span": { + "start": 1168, + "end": 1221, + "ctxt": 0 + }, + "elemTypes": [ + { + "type": "TsTupleElement", + "span": { + "start": 1169, + "end": 1197, + "ctxt": 0 + }, + "label": null, + "ty": { + "type": "TsRestType", + "span": { + "start": 1169, + "end": 1197, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsArrayType", + "span": { + "start": 1172, + "end": 1197, + "ctxt": 0 + }, + "elemType": { + "type": "TsParenthesizedType", + "span": { + "start": 1172, + "end": 1195, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsFunctionType", + "span": { + "start": 1173, + "end": 1194, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 1174, + "end": 1185, + "ctxt": 0 + }, + "value": "arg", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 1177, + "end": 1185, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 1179, + "end": 1185, + "ctxt": 0 + }, + "kind": "number" + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 1187, + "end": 1194, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 1190, + "end": 1194, + "ctxt": 0 + }, + "kind": "void" + } + } + } + } + } + } + }, + { + "type": "TsTupleElement", + "span": { + "start": 1199, + "end": 1220, + "ctxt": 0 + }, + "label": null, + "ty": { + "type": "TsFunctionType", + "span": { + "start": 1199, + "end": 1220, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 1200, + "end": 1211, + "ctxt": 0 + }, + "value": "arg", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 1203, + "end": 1211, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 1205, + "end": 1211, + "ctxt": 0 + }, + "kind": "string" + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 1213, + "end": 1220, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 1216, + "end": 1220, + "ctxt": 0 + }, + "kind": "void" + } + } + } + } + ] + } + } + } + } + ], + "decorators": [], + "span": { + "start": 1137, + "end": 1229, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 1222, + "end": 1228, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 1224, + "end": 1228, + "ctxt": 0 + }, + "kind": "void" + } + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 1233, + "end": 1262, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 1233, + "end": 1261, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 1233, + "end": 1237, + "ctxt": 0 + }, + "value": "test", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 1238, + "end": 1244, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 1238, + "end": 1239, + "ctxt": 0 + }, + "value": "a", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "Identifier", + "span": { + "start": 1243, + "end": 1244, + "ctxt": 0 + }, + "value": "a", + "optional": false + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + }, + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 1246, + "end": 1252, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 1246, + "end": 1247, + "ctxt": 0 + }, + "value": "b", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "Identifier", + "span": { + "start": 1251, + "end": 1252, + "ctxt": 0 + }, + "value": "b", + "optional": false + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + }, + { + "spread": null, + "expression": { + "type": "ArrowFunctionExpression", + "span": { + "start": 1254, + "end": 1260, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 1254, + "end": 1255, + "ctxt": 0 + }, + "value": "c", + "optional": false, + "typeAnnotation": null + } + ], + "body": { + "type": "Identifier", + "span": { + "start": 1259, + "end": 1260, + "ctxt": 0 + }, + "value": "c", + "optional": false + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + } + ], + "typeArguments": null + } + } + ], + "interpreter": null +} diff --git a/crates/swc_ecma_parser/tests/tsc/contextualTypeTupleEnd.ts b/crates/swc_ecma_parser/tests/tsc/contextualTypeTupleEnd.ts new file mode 100644 index 000000000000..408445000d5c --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/contextualTypeTupleEnd.ts @@ -0,0 +1,55 @@ +// @strict: true +// @noEmit: true + +type Funcs = [...((arg: number) => void)[], (arg: string) => void]; + +declare function num(x: number): void; +declare function str(x: string): void; + +declare function f1(...args: Funcs): void; + +f1(); // Error +f1(x => str(x)); +f1(x => num(x), x => str(x)); +f1(x => num(x), x => num(x), x => str(x)); + +const a0: Funcs = []; // Error +const a1: Funcs = [x => str(x)]; +const a2: Funcs = [x => num(x), x => str(x)]; +const a3: Funcs = [x => num(x), x => num(x), x => str(x)]; + +// Repro from #43122 + +export type Selector = (state: State) => unknown; +export type SelectorTuple = Selector[]; + +export type ExampleState = { + foo: "foo"; + bar: 42; +}; + +export function createSelector>(...selectors: [...selectors: S, f: (x: any) => any]) { + console.log(selectors); +} + +createSelector( + x => x.foo, + x => x.bar, + () => 42 +); + +// Repro from #43122 + +declare function example(...args: [...((n: number) => void)[], (x: any) => void]): void + +example( + x => x.foo, // Error + x => x.bar, // Error + x => x.baz, +); + +// Repro from #52846 + +declare function test(...args: [...((arg: number) => void)[], (arg: string) => void]): void; + +test(a => a, b => b, c => c); diff --git a/crates/swc_ecma_parser/tests/tsc/es2022IntlAPIs.json b/crates/swc_ecma_parser/tests/tsc/es2022IntlAPIs.json index 216cb448e290..e28b23143fb8 100644 --- a/crates/swc_ecma_parser/tests/tsc/es2022IntlAPIs.json +++ b/crates/swc_ecma_parser/tests/tsc/es2022IntlAPIs.json @@ -2,7 +2,7 @@ "type": "Script", "span": { "start": 159, - "end": 434, + "end": 632, "ctxt": 0 }, "body": [ @@ -338,6 +338,280 @@ } ] } + }, + { + "type": "VariableDeclaration", + "span": { + "start": 436, + "end": 546, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 442, + "end": 545, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 442, + "end": 457, + "ctxt": 0 + }, + "value": "enumerationKeys", + "optional": false, + "typeAnnotation": null + }, + "init": { + "type": "TsConstAssertion", + "span": { + "start": 460, + "end": 545, + "ctxt": 0 + }, + "expression": { + "type": "ArrayExpression", + "span": { + "start": 460, + "end": 536, + "ctxt": 0 + }, + "elements": [ + { + "spread": null, + "expression": { + "type": "StringLiteral", + "span": { + "start": 461, + "end": 471, + "ctxt": 0 + }, + "value": "calendar", + "raw": "'calendar'" + } + }, + { + "spread": null, + "expression": { + "type": "StringLiteral", + "span": { + "start": 473, + "end": 484, + "ctxt": 0 + }, + "value": "collation", + "raw": "'collation'" + } + }, + { + "spread": null, + "expression": { + "type": "StringLiteral", + "span": { + "start": 486, + "end": 496, + "ctxt": 0 + }, + "value": "currency", + "raw": "'currency'" + } + }, + { + "spread": null, + "expression": { + "type": "StringLiteral", + "span": { + "start": 498, + "end": 515, + "ctxt": 0 + }, + "value": "numberingSystem", + "raw": "'numberingSystem'" + } + }, + { + "spread": null, + "expression": { + "type": "StringLiteral", + "span": { + "start": 517, + "end": 527, + "ctxt": 0 + }, + "value": "timeZone", + "raw": "'timeZone'" + } + }, + { + "spread": null, + "expression": { + "type": "StringLiteral", + "span": { + "start": 529, + "end": 535, + "ctxt": 0 + }, + "value": "unit", + "raw": "'unit'" + } + } + ] + } + }, + "definite": false + } + ] + }, + { + "type": "ForOfStatement", + "span": { + "start": 547, + "end": 632, + "ctxt": 0 + }, + "await": false, + "left": { + "type": "VariableDeclaration", + "span": { + "start": 552, + "end": 561, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 558, + "end": 561, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 558, + "end": 561, + "ctxt": 0 + }, + "value": "key", + "optional": false, + "typeAnnotation": null + }, + "init": null, + "definite": false + } + ] + }, + "right": { + "type": "Identifier", + "span": { + "start": 565, + "end": 580, + "ctxt": 0 + }, + "value": "enumerationKeys", + "optional": false + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 582, + "end": 632, + "ctxt": 0 + }, + "stmts": [ + { + "type": "VariableDeclaration", + "span": { + "start": 586, + "end": 630, + "ctxt": 0 + }, + "kind": "var", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 590, + "end": 629, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 590, + "end": 599, + "ctxt": 0 + }, + "value": "supported", + "optional": false, + "typeAnnotation": null + }, + "init": { + "type": "CallExpression", + "span": { + "start": 602, + "end": 629, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 602, + "end": 624, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 602, + "end": 606, + "ctxt": 0 + }, + "value": "Intl", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 607, + "end": 624, + "ctxt": 0 + }, + "value": "supportedValuesOf", + "optional": false + } + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "Identifier", + "span": { + "start": 625, + "end": 628, + "ctxt": 0 + }, + "value": "key", + "optional": false + } + } + ], + "typeArguments": null + }, + "definite": false + } + ] + } + ] + } } ], "interpreter": null diff --git a/crates/swc_ecma_parser/tests/tsc/es2022IntlAPIs.ts b/crates/swc_ecma_parser/tests/tsc/es2022IntlAPIs.ts index f297e842b1a1..19d3160e7170 100644 --- a/crates/swc_ecma_parser/tests/tsc/es2022IntlAPIs.ts +++ b/crates/swc_ecma_parser/tests/tsc/es2022IntlAPIs.ts @@ -8,3 +8,8 @@ for (const zoneName of timezoneNames) { timeZoneName: zoneName, }); } + +const enumerationKeys = ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit'] as const; +for (const key of enumerationKeys) { + var supported = Intl.supportedValuesOf(key); +} diff --git a/crates/swc_ecma_parser/tests/tsc/exportTypeMergedWithExportStarAsNamespace.json b/crates/swc_ecma_parser/tests/tsc/exportTypeMergedWithExportStarAsNamespace.json new file mode 100644 index 000000000000..436b761c6859 --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/exportTypeMergedWithExportStarAsNamespace.json @@ -0,0 +1,876 @@ +{ + "type": "Module", + "span": { + "start": 24, + "end": 472, + "ctxt": 0 + }, + "body": [ + { + "type": "ImportDeclaration", + "span": { + "start": 24, + "end": 61, + "ctxt": 0 + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "span": { + "start": 33, + "end": 42, + "ctxt": 0 + }, + "local": { + "type": "Identifier", + "span": { + "start": 33, + "end": 42, + "ctxt": 0 + }, + "value": "Something", + "optional": false + }, + "imported": null, + "isTypeOnly": false + } + ], + "source": { + "type": "StringLiteral", + "span": { + "start": 50, + "end": 61, + "ctxt": 0 + }, + "value": "./prelude", + "raw": "\"./prelude\"" + }, + "typeOnly": false, + "asserts": null + }, + { + "type": "ExportDeclaration", + "span": { + "start": 62, + "end": 123, + "ctxt": 0 + }, + "declaration": { + "type": "VariableDeclaration", + "span": { + "start": 69, + "end": 123, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 75, + "end": 123, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 75, + "end": 82, + "ctxt": 0 + }, + "value": "myValue", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 82, + "end": 101, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 84, + "end": 101, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 84, + "end": 93, + "ctxt": 0 + }, + "value": "Something", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 93, + "end": 101, + "ctxt": 0 + }, + "params": [ + { + "type": "TsKeywordType", + "span": { + "start": 94, + "end": 100, + "ctxt": 0 + }, + "kind": "string" + } + ] + } + } + } + }, + "init": { + "type": "CallExpression", + "span": { + "start": 104, + "end": 123, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 104, + "end": 116, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 104, + "end": 113, + "ctxt": 0 + }, + "value": "Something", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 114, + "end": 116, + "ctxt": 0 + }, + "value": "of", + "optional": false + } + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "StringLiteral", + "span": { + "start": 117, + "end": 122, + "ctxt": 0 + }, + "value": "abc", + "raw": "\"abc\"" + } + } + ], + "typeArguments": null + }, + "definite": false + } + ] + } + }, + { + "type": "ExportDeclaration", + "span": { + "start": 124, + "end": 170, + "ctxt": 0 + }, + "declaration": { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 131, + "end": 170, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 136, + "end": 142, + "ctxt": 0 + }, + "value": "MyType", + "optional": false + }, + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 145, + "end": 170, + "ctxt": 0 + }, + "typeName": { + "type": "TsQualifiedName", + "left": { + "type": "Identifier", + "span": { + "start": 145, + "end": 154, + "ctxt": 0 + }, + "value": "Something", + "optional": false + }, + "right": { + "type": "Identifier", + "span": { + "start": 155, + "end": 162, + "ctxt": 0 + }, + "value": "SubType", + "optional": false + } + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 162, + "end": 170, + "ctxt": 0 + }, + "params": [ + { + "type": "TsKeywordType", + "span": { + "start": 163, + "end": 169, + "ctxt": 0 + }, + "kind": "string" + } + ] + } + } + } + }, + { + "type": "ExportDeclaration", + "span": { + "start": 199, + "end": 238, + "ctxt": 0 + }, + "declaration": { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 206, + "end": 238, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 211, + "end": 220, + "ctxt": 0 + }, + "value": "Something", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 220, + "end": 223, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 221, + "end": 222, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 221, + "end": 222, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsTypeLiteral", + "span": { + "start": 226, + "end": 238, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 228, + "end": 236, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 228, + "end": 233, + "ctxt": 0 + }, + "value": "value", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 233, + "end": 236, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 235, + "end": 236, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 235, + "end": 236, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "typeParams": null + } + }, + "typeParams": null + } + ] + } + } + }, + { + "type": "ExportDeclaration", + "span": { + "start": 239, + "end": 276, + "ctxt": 0 + }, + "declaration": { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 246, + "end": 276, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 251, + "end": 258, + "ctxt": 0 + }, + "value": "SubType", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 258, + "end": 261, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 259, + "end": 260, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 259, + "end": 260, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsTypeLiteral", + "span": { + "start": 264, + "end": 276, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 266, + "end": 274, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 266, + "end": 271, + "ctxt": 0 + }, + "value": "value", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 271, + "end": 274, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 273, + "end": 274, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 273, + "end": 274, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "typeParams": null + } + }, + "typeParams": null + } + ] + } + } + }, + { + "type": "ExportDeclaration", + "span": { + "start": 277, + "end": 330, + "ctxt": 0 + }, + "declaration": { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 301, + "end": 303, + "ctxt": 0 + }, + "value": "of", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 307, + "end": 315, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 307, + "end": 315, + "ctxt": 0 + }, + "value": "value", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 312, + "end": 315, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 314, + "end": 315, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 314, + "end": 315, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "typeParams": null + } + } + } + } + ], + "decorators": [], + "span": { + "start": 284, + "end": 330, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 303, + "end": 306, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 304, + "end": 305, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 304, + "end": 305, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 316, + "end": 330, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 318, + "end": 330, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 318, + "end": 327, + "ctxt": 0 + }, + "value": "Something", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 327, + "end": 330, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 328, + "end": 329, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 328, + "end": 329, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "typeParams": null + } + ] + } + } + } + } + }, + { + "type": "ImportDeclaration", + "span": { + "start": 357, + "end": 389, + "ctxt": 0 + }, + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "span": { + "start": 364, + "end": 370, + "ctxt": 0 + }, + "local": { + "type": "Identifier", + "span": { + "start": 369, + "end": 370, + "ctxt": 0 + }, + "value": "S", + "optional": false + } + } + ], + "source": { + "type": "StringLiteral", + "span": { + "start": 376, + "end": 389, + "ctxt": 0 + }, + "value": "./Something", + "raw": "\"./Something\"" + }, + "typeOnly": false, + "asserts": null + }, + { + "type": "ExportNamedDeclaration", + "span": { + "start": 390, + "end": 430, + "ctxt": 0 + }, + "specifiers": [ + { + "type": "ExportNamespaceSpecifier", + "span": { + "start": 397, + "end": 411, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 402, + "end": 411, + "ctxt": 0 + }, + "value": "Something", + "optional": false + } + } + ], + "source": { + "type": "StringLiteral", + "span": { + "start": 417, + "end": 430, + "ctxt": 0 + }, + "value": "./Something", + "raw": "\"./Something\"" + }, + "typeOnly": false, + "asserts": null + }, + { + "type": "ExportDeclaration", + "span": { + "start": 431, + "end": 472, + "ctxt": 0 + }, + "declaration": { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 438, + "end": 472, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 443, + "end": 452, + "ctxt": 0 + }, + "value": "Something", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 452, + "end": 455, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 453, + "end": 454, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 453, + "end": 454, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 458, + "end": 472, + "ctxt": 0 + }, + "typeName": { + "type": "TsQualifiedName", + "left": { + "type": "Identifier", + "span": { + "start": 458, + "end": 459, + "ctxt": 0 + }, + "value": "S", + "optional": false + }, + "right": { + "type": "Identifier", + "span": { + "start": 460, + "end": 469, + "ctxt": 0 + }, + "value": "Something", + "optional": false + } + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 469, + "end": 472, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 470, + "end": 471, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 470, + "end": 471, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "typeParams": null + } + ] + } + } + } + } + ], + "interpreter": null +} diff --git a/crates/swc_ecma_parser/tests/tsc/exportTypeMergedWithExportStarAsNamespace.ts b/crates/swc_ecma_parser/tests/tsc/exportTypeMergedWithExportStarAsNamespace.ts new file mode 100644 index 000000000000..a9feef345b8d --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/exportTypeMergedWithExportStarAsNamespace.ts @@ -0,0 +1,14 @@ +// @Filename: usage.ts +import { Something } from "./prelude" +export const myValue: Something = Something.of("abc") +export type MyType = Something.SubType + +// @Filename: Something.ts +export type Something = { value: A } +export type SubType = { value: A } +export declare function of(value: A): Something + +// @Filename: prelude.ts +import * as S from "./Something" +export * as Something from "./Something" +export type Something = S.Something diff --git a/crates/swc_ecma_parser/tests/tsc/extendsTag5.json b/crates/swc_ecma_parser/tests/tsc/extendsTag5.json new file mode 100644 index 000000000000..bea7bfe37b54 --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/extendsTag5.json @@ -0,0 +1,248 @@ +{ + "type": "Script", + "span": { + "start": 189, + "end": 591, + "ctxt": 0 + }, + "body": [ + { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 195, + "end": 196, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "declare": false, + "span": { + "start": 189, + "end": 274, + "ctxt": 0 + }, + "decorators": [], + "body": [ + { + "type": "Constructor", + "span": { + "start": 235, + "end": 272, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 235, + "end": 246, + "ctxt": 0 + }, + "value": "constructor", + "optional": false + }, + "params": [ + { + "type": "Parameter", + "span": { + "start": 247, + "end": 248, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 247, + "end": 248, + "ctxt": 0 + }, + "value": "a", + "optional": false, + "typeAnnotation": null + } + } + ], + "body": { + "type": "BlockStatement", + "span": { + "start": 250, + "end": 272, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ReturnStatement", + "span": { + "start": 259, + "end": 267, + "ctxt": 0 + }, + "argument": { + "type": "Identifier", + "span": { + "start": 266, + "end": 267, + "ctxt": 0 + }, + "value": "a", + "optional": false + } + } + ] + }, + "accessibility": null, + "isOptional": false + } + ], + "superClass": null, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + }, + { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 346, + "end": 347, + "ctxt": 0 + }, + "value": "B", + "optional": false + }, + "declare": false, + "span": { + "start": 340, + "end": 360, + "ctxt": 0 + }, + "decorators": [], + "body": [], + "superClass": { + "type": "Identifier", + "span": { + "start": 356, + "end": 357, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + }, + { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 435, + "end": 436, + "ctxt": 0 + }, + "value": "C", + "optional": false + }, + "declare": false, + "span": { + "start": 429, + "end": 449, + "ctxt": 0 + }, + "decorators": [], + "body": [], + "superClass": { + "type": "Identifier", + "span": { + "start": 445, + "end": 446, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + }, + { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 507, + "end": 508, + "ctxt": 0 + }, + "value": "D", + "optional": false + }, + "declare": false, + "span": { + "start": 501, + "end": 521, + "ctxt": 0 + }, + "decorators": [], + "body": [], + "superClass": { + "type": "Identifier", + "span": { + "start": 517, + "end": 518, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + }, + { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 577, + "end": 578, + "ctxt": 0 + }, + "value": "E", + "optional": false + }, + "declare": false, + "span": { + "start": 571, + "end": 591, + "ctxt": 0 + }, + "decorators": [], + "body": [], + "superClass": { + "type": "Identifier", + "span": { + "start": 587, + "end": 588, + "ctxt": 0 + }, + "value": "A", + "optional": false + }, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + } + ], + "interpreter": null +} diff --git a/crates/swc_ecma_parser/tests/tsc/extendsTag5.ts b/crates/swc_ecma_parser/tests/tsc/extendsTag5.ts new file mode 100644 index 000000000000..0f7157e9e8af --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/extendsTag5.ts @@ -0,0 +1,49 @@ +// @checkJs: true +// @allowJs: true +// @noEmit: true +// @filename: /a.js + +/** + * @typedef {{ +* a: number | string; +* b: boolean | string[]; +* }} Foo +*/ + +/** +* @template {Foo} T +*/ +class A { + /** + * @param {T} a + */ + constructor(a) { + return a + } +} + +/** +* @extends {A<{ +* a: string, +* b: string[] +* }>} +*/ +class B extends A {} + +/** + * @extends {A<{ + * a: string, + * b: string + * }>} + */ +class C extends A {} + +/** + * @extends {A<{a: string, b: string[]}>} + */ +class D extends A {} + +/** + * @extends {A<{a: string, b: string}>} + */ +class E extends A {} diff --git a/crates/swc_ecma_parser/tests/tsc/genericContextualTypes2.json b/crates/swc_ecma_parser/tests/tsc/genericContextualTypes2.json new file mode 100644 index 000000000000..a81b6d00057c --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/genericContextualTypes2.json @@ -0,0 +1,1861 @@ +{ + "type": "Script", + "span": { + "start": 36, + "end": 879, + "ctxt": 0 + }, + "body": [ + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 36, + "end": 62, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 41, + "end": 49, + "ctxt": 0 + }, + "value": "LowInfer", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 49, + "end": 52, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 50, + "end": 51, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 50, + "end": 51, + "ctxt": 0 + }, + "value": "T", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsIntersectionType", + "span": { + "start": 55, + "end": 61, + "ctxt": 0 + }, + "types": [ + { + "type": "TsTypeReference", + "span": { + "start": 55, + "end": 56, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 55, + "end": 56, + "ctxt": 0 + }, + "value": "T", + "optional": false + }, + "typeParams": null + }, + { + "type": "TsTypeLiteral", + "span": { + "start": 59, + "end": 61, + "ctxt": 0 + }, + "members": [] + } + ] + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 64, + "end": 168, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 69, + "end": 84, + "ctxt": 0 + }, + "value": "PartialAssigner", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 84, + "end": 123, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 85, + "end": 93, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 85, + "end": 93, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + }, + { + "type": "TsTypeParameter", + "span": { + "start": 95, + "end": 122, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 95, + "end": 99, + "ctxt": 0 + }, + "value": "TKey", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsTypeOperator", + "span": { + "start": 108, + "end": 122, + "ctxt": 0 + }, + "op": "keyof", + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 114, + "end": 122, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 114, + "end": 122, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + }, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsFunctionType", + "span": { + "start": 126, + "end": 167, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 130, + "end": 147, + "ctxt": 0 + }, + "value": "context", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 137, + "end": 147, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 139, + "end": 147, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 139, + "end": 147, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 150, + "end": 167, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsIndexedAccessType", + "span": { + "start": 153, + "end": 167, + "ctxt": 0 + }, + "readonly": false, + "objectType": { + "type": "TsTypeReference", + "span": { + "start": 153, + "end": 161, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 153, + "end": 161, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + }, + "indexType": { + "type": "TsTypeReference", + "span": { + "start": 162, + "end": 166, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 162, + "end": 166, + "ctxt": 0 + }, + "value": "TKey", + "optional": false + }, + "typeParams": null + } + } + } + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 170, + "end": 278, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 175, + "end": 191, + "ctxt": 0 + }, + "value": "PropertyAssigner", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 191, + "end": 201, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 192, + "end": 200, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 192, + "end": 200, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsMappedType", + "span": { + "start": 204, + "end": 277, + "ctxt": 0 + }, + "readonly": null, + "typeParam": { + "type": "TsTypeParameter", + "span": { + "start": 209, + "end": 228, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 209, + "end": 210, + "ctxt": 0 + }, + "value": "K", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsTypeOperator", + "span": { + "start": 214, + "end": 228, + "ctxt": 0 + }, + "op": "keyof", + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 220, + "end": 228, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 220, + "end": 228, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + }, + "default": null + }, + "nameType": null, + "optional": true, + "typeAnnotation": { + "type": "TsUnionType", + "span": { + "start": 232, + "end": 274, + "ctxt": 0 + }, + "types": [ + { + "type": "TsTypeReference", + "span": { + "start": 232, + "end": 260, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 232, + "end": 247, + "ctxt": 0 + }, + "value": "PartialAssigner", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 247, + "end": 260, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 248, + "end": 256, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 248, + "end": 256, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + }, + { + "type": "TsTypeReference", + "span": { + "start": 258, + "end": 259, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 258, + "end": 259, + "ctxt": 0 + }, + "value": "K", + "optional": false + }, + "typeParams": null + } + ] + } + }, + { + "type": "TsIndexedAccessType", + "span": { + "start": 263, + "end": 274, + "ctxt": 0 + }, + "readonly": false, + "objectType": { + "type": "TsTypeReference", + "span": { + "start": 263, + "end": 271, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 263, + "end": 271, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + }, + "indexType": { + "type": "TsTypeReference", + "span": { + "start": 272, + "end": 273, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 272, + "end": 273, + "ctxt": 0 + }, + "value": "K", + "optional": false + }, + "typeParams": null + } + } + ] + } + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 280, + "end": 339, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 285, + "end": 289, + "ctxt": 0 + }, + "value": "Meta", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 289, + "end": 299, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 290, + "end": 298, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 290, + "end": 298, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsTypeLiteral", + "span": { + "start": 302, + "end": 339, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 306, + "end": 337, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 306, + "end": 312, + "ctxt": 0 + }, + "value": "action", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 312, + "end": 337, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsFunctionType", + "span": { + "start": 314, + "end": 337, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 315, + "end": 328, + "ctxt": 0 + }, + "value": "ctx", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 318, + "end": 328, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 320, + "end": 328, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 320, + "end": 328, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 330, + "end": 337, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 333, + "end": 337, + "ctxt": 0 + }, + "kind": "void" + } + } + } + }, + "typeParams": null + } + ] + } + }, + { + "type": "TsInterfaceDeclaration", + "span": { + "start": 341, + "end": 457, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 351, + "end": 363, + "ctxt": 0 + }, + "value": "AssignAction", + "optional": false + }, + "declare": false, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 363, + "end": 373, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 364, + "end": 372, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 364, + "end": 372, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "extends": [], + "body": { + "type": "TsInterfaceBody", + "span": { + "start": 374, + "end": 457, + "ctxt": 0 + }, + "body": [ + { + "type": "TsPropertySignature", + "span": { + "start": 378, + "end": 400, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 378, + "end": 382, + "ctxt": 0 + }, + "value": "type", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 382, + "end": 399, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsLiteralType", + "span": { + "start": 384, + "end": 399, + "ctxt": 0 + }, + "literal": { + "type": "StringLiteral", + "span": { + "start": 384, + "end": 399, + "ctxt": 0 + }, + "value": "xstate.assign", + "raw": "\"xstate.assign\"" + } + } + }, + "typeParams": null + }, + { + "type": "TsPropertySignature", + "span": { + "start": 403, + "end": 455, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 403, + "end": 407, + "ctxt": 0 + }, + "value": "exec", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 407, + "end": 454, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsFunctionType", + "span": { + "start": 409, + "end": 454, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 410, + "end": 423, + "ctxt": 0 + }, + "value": "arg", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 413, + "end": 423, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 415, + "end": 423, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 415, + "end": 423, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + } + }, + { + "type": "Identifier", + "span": { + "start": 425, + "end": 445, + "ctxt": 0 + }, + "value": "meta", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 429, + "end": 445, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 431, + "end": 445, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 431, + "end": 435, + "ctxt": 0 + }, + "value": "Meta", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 435, + "end": 445, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 436, + "end": 444, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 436, + "end": 444, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + ] + } + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 447, + "end": 454, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 450, + "end": 454, + "ctxt": 0 + }, + "kind": "void" + } + } + } + }, + "typeParams": null + } + ] + } + }, + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 476, + "end": 482, + "ctxt": 0 + }, + "value": "assign", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 496, + "end": 544, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 496, + "end": 544, + "ctxt": 0 + }, + "value": "assignment", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 506, + "end": 544, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 508, + "end": 544, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 508, + "end": 524, + "ctxt": 0 + }, + "value": "PropertyAssigner", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 524, + "end": 544, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 525, + "end": 543, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 525, + "end": 533, + "ctxt": 0 + }, + "value": "LowInfer", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 533, + "end": 543, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 534, + "end": 542, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 534, + "end": 542, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + ] + } + } + ] + } + } + } + } + } + ], + "decorators": [], + "span": { + "start": 459, + "end": 571, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 482, + "end": 492, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 483, + "end": 491, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 483, + "end": 491, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 546, + "end": 570, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 548, + "end": 570, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 548, + "end": 560, + "ctxt": 0 + }, + "value": "AssignAction", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 560, + "end": 570, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 561, + "end": 569, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 561, + "end": 569, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + ] + } + } + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 573, + "end": 656, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 578, + "end": 584, + "ctxt": 0 + }, + "value": "Config", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 584, + "end": 594, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 585, + "end": 593, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 585, + "end": 593, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsTypeLiteral", + "span": { + "start": 597, + "end": 655, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 601, + "end": 619, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 601, + "end": 608, + "ctxt": 0 + }, + "value": "context", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 608, + "end": 618, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 610, + "end": 618, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 610, + "end": 618, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + }, + "typeParams": null + }, + { + "type": "TsPropertySignature", + "span": { + "start": 622, + "end": 653, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 622, + "end": 627, + "ctxt": 0 + }, + "value": "entry", + "optional": false + }, + "computed": false, + "optional": true, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 628, + "end": 652, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 630, + "end": 652, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 630, + "end": 642, + "ctxt": 0 + }, + "value": "AssignAction", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 642, + "end": 652, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 643, + "end": 651, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 643, + "end": 651, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + ] + } + } + }, + "typeParams": null + } + ] + } + }, + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 675, + "end": 688, + "ctxt": 0 + }, + "value": "createMachine", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 699, + "end": 723, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 699, + "end": 723, + "ctxt": 0 + }, + "value": "config", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 705, + "end": 723, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 707, + "end": 723, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 707, + "end": 713, + "ctxt": 0 + }, + "value": "Config", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 713, + "end": 723, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 714, + "end": 722, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 714, + "end": 722, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + ] + } + } + } + } + } + ], + "decorators": [], + "span": { + "start": 658, + "end": 731, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 688, + "end": 698, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 689, + "end": 697, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 689, + "end": 697, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 724, + "end": 730, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 726, + "end": 730, + "ctxt": 0 + }, + "kind": "void" + } + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 733, + "end": 879, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 733, + "end": 878, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 733, + "end": 746, + "ctxt": 0 + }, + "value": "createMachine", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "ObjectExpression", + "span": { + "start": 766, + "end": 877, + "ctxt": 0 + }, + "properties": [ + { + "type": "KeyValueProperty", + "key": { + "type": "Identifier", + "span": { + "start": 770, + "end": 777, + "ctxt": 0 + }, + "value": "context", + "optional": false + }, + "value": { + "type": "ObjectExpression", + "span": { + "start": 779, + "end": 798, + "ctxt": 0 + }, + "properties": [ + { + "type": "KeyValueProperty", + "key": { + "type": "Identifier", + "span": { + "start": 785, + "end": 790, + "ctxt": 0 + }, + "value": "count", + "optional": false + }, + "value": { + "type": "NumericLiteral", + "span": { + "start": 792, + "end": 793, + "ctxt": 0 + }, + "value": 0.0, + "raw": "0" + } + } + ] + } + }, + { + "type": "KeyValueProperty", + "key": { + "type": "Identifier", + "span": { + "start": 802, + "end": 807, + "ctxt": 0 + }, + "value": "entry", + "optional": false + }, + "value": { + "type": "CallExpression", + "span": { + "start": 809, + "end": 874, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 809, + "end": 815, + "ctxt": 0 + }, + "value": "assign", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "ObjectExpression", + "span": { + "start": 816, + "end": 873, + "ctxt": 0 + }, + "properties": [ + { + "type": "KeyValueProperty", + "key": { + "type": "Identifier", + "span": { + "start": 822, + "end": 827, + "ctxt": 0 + }, + "value": "count", + "optional": false + }, + "value": { + "type": "ArrowFunctionExpression", + "span": { + "start": 829, + "end": 868, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 830, + "end": 852, + "ctxt": 0 + }, + "value": "ctx", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 833, + "end": 852, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeLiteral", + "span": { + "start": 835, + "end": 852, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 837, + "end": 850, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 837, + "end": 842, + "ctxt": 0 + }, + "value": "count", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 842, + "end": 850, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 844, + "end": 850, + "ctxt": 0 + }, + "kind": "number" + } + }, + "typeParams": null + } + ] + } + } + } + ], + "body": { + "type": "UpdateExpression", + "span": { + "start": 857, + "end": 868, + "ctxt": 0 + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "MemberExpression", + "span": { + "start": 859, + "end": 868, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 859, + "end": 862, + "ctxt": 0 + }, + "value": "ctx", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 863, + "end": 868, + "ctxt": 0 + }, + "value": "count", + "optional": false + } + } + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + } + ] + } + } + ], + "typeArguments": null + } + } + ] + } + } + ], + "typeArguments": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 746, + "end": 765, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeLiteral", + "span": { + "start": 747, + "end": 764, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 749, + "end": 762, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 749, + "end": 754, + "ctxt": 0 + }, + "value": "count", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 754, + "end": 762, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 756, + "end": 762, + "ctxt": 0 + }, + "kind": "number" + } + }, + "typeParams": null + } + ] + } + ] + } + } + } + ], + "interpreter": null +} diff --git a/crates/swc_ecma_parser/tests/tsc/genericContextualTypes2.ts b/crates/swc_ecma_parser/tests/tsc/genericContextualTypes2.ts new file mode 100644 index 000000000000..fb47811060ba --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/genericContextualTypes2.ts @@ -0,0 +1,41 @@ +// @strict: true +// @noEmit: true + +type LowInfer = T & {}; + +type PartialAssigner = ( + context: TContext +) => TContext[TKey]; + +type PropertyAssigner = { + [K in keyof TContext]?: PartialAssigner | TContext[K]; +}; + +type Meta = { + action: (ctx: TContext) => void +} + +interface AssignAction { + type: "xstate.assign"; + exec: (arg: TContext, meta: Meta) => void; +} + +declare function assign( + assignment: PropertyAssigner> +): AssignAction; + +type Config = { + context: TContext; + entry?: AssignAction; +}; + +declare function createMachine(config: Config): void; + +createMachine<{ count: number }>({ + context: { + count: 0, + }, + entry: assign({ + count: (ctx: { count: number }) => ++ctx.count, + }), +}); diff --git a/crates/swc_ecma_parser/tests/tsc/genericContextualTypes3.json b/crates/swc_ecma_parser/tests/tsc/genericContextualTypes3.json new file mode 100644 index 000000000000..e1e923891d52 --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/genericContextualTypes3.json @@ -0,0 +1,1829 @@ +{ + "type": "Script", + "span": { + "start": 36, + "end": 871, + "ctxt": 0 + }, + "body": [ + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 36, + "end": 62, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 41, + "end": 49, + "ctxt": 0 + }, + "value": "LowInfer", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 49, + "end": 52, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 50, + "end": 51, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 50, + "end": 51, + "ctxt": 0 + }, + "value": "T", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsIntersectionType", + "span": { + "start": 55, + "end": 61, + "ctxt": 0 + }, + "types": [ + { + "type": "TsTypeReference", + "span": { + "start": 55, + "end": 56, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 55, + "end": 56, + "ctxt": 0 + }, + "value": "T", + "optional": false + }, + "typeParams": null + }, + { + "type": "TsTypeLiteral", + "span": { + "start": 59, + "end": 61, + "ctxt": 0 + }, + "members": [] + } + ] + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 64, + "end": 168, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 69, + "end": 84, + "ctxt": 0 + }, + "value": "PartialAssigner", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 84, + "end": 123, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 85, + "end": 93, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 85, + "end": 93, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + }, + { + "type": "TsTypeParameter", + "span": { + "start": 95, + "end": 122, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 95, + "end": 99, + "ctxt": 0 + }, + "value": "TKey", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsTypeOperator", + "span": { + "start": 108, + "end": 122, + "ctxt": 0 + }, + "op": "keyof", + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 114, + "end": 122, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 114, + "end": 122, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + }, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsFunctionType", + "span": { + "start": 126, + "end": 167, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 130, + "end": 147, + "ctxt": 0 + }, + "value": "context", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 137, + "end": 147, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 139, + "end": 147, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 139, + "end": 147, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 150, + "end": 167, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsIndexedAccessType", + "span": { + "start": 153, + "end": 167, + "ctxt": 0 + }, + "readonly": false, + "objectType": { + "type": "TsTypeReference", + "span": { + "start": 153, + "end": 161, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 153, + "end": 161, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + }, + "indexType": { + "type": "TsTypeReference", + "span": { + "start": 162, + "end": 166, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 162, + "end": 166, + "ctxt": 0 + }, + "value": "TKey", + "optional": false + }, + "typeParams": null + } + } + } + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 170, + "end": 278, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 175, + "end": 191, + "ctxt": 0 + }, + "value": "PropertyAssigner", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 191, + "end": 201, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 192, + "end": 200, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 192, + "end": 200, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsMappedType", + "span": { + "start": 204, + "end": 277, + "ctxt": 0 + }, + "readonly": null, + "typeParam": { + "type": "TsTypeParameter", + "span": { + "start": 209, + "end": 228, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 209, + "end": 210, + "ctxt": 0 + }, + "value": "K", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsTypeOperator", + "span": { + "start": 214, + "end": 228, + "ctxt": 0 + }, + "op": "keyof", + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 220, + "end": 228, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 220, + "end": 228, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + }, + "default": null + }, + "nameType": null, + "optional": true, + "typeAnnotation": { + "type": "TsUnionType", + "span": { + "start": 232, + "end": 274, + "ctxt": 0 + }, + "types": [ + { + "type": "TsTypeReference", + "span": { + "start": 232, + "end": 260, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 232, + "end": 247, + "ctxt": 0 + }, + "value": "PartialAssigner", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 247, + "end": 260, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 248, + "end": 256, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 248, + "end": 256, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + }, + { + "type": "TsTypeReference", + "span": { + "start": 258, + "end": 259, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 258, + "end": 259, + "ctxt": 0 + }, + "value": "K", + "optional": false + }, + "typeParams": null + } + ] + } + }, + { + "type": "TsIndexedAccessType", + "span": { + "start": 263, + "end": 274, + "ctxt": 0 + }, + "readonly": false, + "objectType": { + "type": "TsTypeReference", + "span": { + "start": 263, + "end": 271, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 263, + "end": 271, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + }, + "indexType": { + "type": "TsTypeReference", + "span": { + "start": 272, + "end": 273, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 272, + "end": 273, + "ctxt": 0 + }, + "value": "K", + "optional": false + }, + "typeParams": null + } + } + ] + } + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 280, + "end": 339, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 285, + "end": 289, + "ctxt": 0 + }, + "value": "Meta", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 289, + "end": 299, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 290, + "end": 298, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 290, + "end": 298, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsTypeLiteral", + "span": { + "start": 302, + "end": 339, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 306, + "end": 337, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 306, + "end": 312, + "ctxt": 0 + }, + "value": "action", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 312, + "end": 337, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsFunctionType", + "span": { + "start": 314, + "end": 337, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 315, + "end": 328, + "ctxt": 0 + }, + "value": "ctx", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 318, + "end": 328, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 320, + "end": 328, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 320, + "end": 328, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + } + } + ], + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 330, + "end": 337, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 333, + "end": 337, + "ctxt": 0 + }, + "kind": "void" + } + } + } + }, + "typeParams": null + } + ] + } + }, + { + "type": "TsInterfaceDeclaration", + "span": { + "start": 341, + "end": 449, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 351, + "end": 363, + "ctxt": 0 + }, + "value": "AssignAction", + "optional": false + }, + "declare": false, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 363, + "end": 373, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 364, + "end": 372, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 364, + "end": 372, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "extends": [], + "body": { + "type": "TsInterfaceBody", + "span": { + "start": 374, + "end": 449, + "ctxt": 0 + }, + "body": [ + { + "type": "TsPropertySignature", + "span": { + "start": 378, + "end": 400, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 378, + "end": 382, + "ctxt": 0 + }, + "value": "type", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 382, + "end": 399, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsLiteralType", + "span": { + "start": 384, + "end": 399, + "ctxt": 0 + }, + "literal": { + "type": "StringLiteral", + "span": { + "start": 384, + "end": 399, + "ctxt": 0 + }, + "value": "xstate.assign", + "raw": "\"xstate.assign\"" + } + } + }, + "typeParams": null + }, + { + "type": "TsCallSignatureDeclaration", + "span": { + "start": 403, + "end": 447, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 404, + "end": 417, + "ctxt": 0 + }, + "value": "arg", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 407, + "end": 417, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 409, + "end": 417, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 409, + "end": 417, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + } + }, + { + "type": "Identifier", + "span": { + "start": 419, + "end": 439, + "ctxt": 0 + }, + "value": "meta", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 423, + "end": 439, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 425, + "end": 439, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 425, + "end": 429, + "ctxt": 0 + }, + "value": "Meta", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 429, + "end": 439, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 430, + "end": 438, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 430, + "end": 438, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + ] + } + } + } + } + ], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 440, + "end": 446, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 442, + "end": 446, + "ctxt": 0 + }, + "kind": "void" + } + }, + "typeParams": null + } + ] + } + }, + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 468, + "end": 474, + "ctxt": 0 + }, + "value": "assign", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 488, + "end": 536, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 488, + "end": 536, + "ctxt": 0 + }, + "value": "assignment", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 498, + "end": 536, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 500, + "end": 536, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 500, + "end": 516, + "ctxt": 0 + }, + "value": "PropertyAssigner", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 516, + "end": 536, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 517, + "end": 535, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 517, + "end": 525, + "ctxt": 0 + }, + "value": "LowInfer", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 525, + "end": 535, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 526, + "end": 534, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 526, + "end": 534, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + ] + } + } + ] + } + } + } + } + } + ], + "decorators": [], + "span": { + "start": 451, + "end": 563, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 474, + "end": 484, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 475, + "end": 483, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 475, + "end": 483, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 538, + "end": 562, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 540, + "end": 562, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 540, + "end": 552, + "ctxt": 0 + }, + "value": "AssignAction", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 552, + "end": 562, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 553, + "end": 561, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 553, + "end": 561, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + ] + } + } + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 565, + "end": 648, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 570, + "end": 576, + "ctxt": 0 + }, + "value": "Config", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 576, + "end": 586, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 577, + "end": 585, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 577, + "end": 585, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsTypeLiteral", + "span": { + "start": 589, + "end": 647, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 593, + "end": 611, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 593, + "end": 600, + "ctxt": 0 + }, + "value": "context", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 600, + "end": 610, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 602, + "end": 610, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 602, + "end": 610, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + }, + "typeParams": null + }, + { + "type": "TsPropertySignature", + "span": { + "start": 614, + "end": 645, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 614, + "end": 619, + "ctxt": 0 + }, + "value": "entry", + "optional": false + }, + "computed": false, + "optional": true, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 620, + "end": 644, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 622, + "end": 644, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 622, + "end": 634, + "ctxt": 0 + }, + "value": "AssignAction", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 634, + "end": 644, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 635, + "end": 643, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 635, + "end": 643, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + ] + } + } + }, + "typeParams": null + } + ] + } + }, + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 667, + "end": 680, + "ctxt": 0 + }, + "value": "createMachine", + "optional": false + }, + "declare": true, + "params": [ + { + "type": "Parameter", + "span": { + "start": 691, + "end": 715, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 691, + "end": 715, + "ctxt": 0 + }, + "value": "config", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 697, + "end": 715, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 699, + "end": 715, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 699, + "end": 705, + "ctxt": 0 + }, + "value": "Config", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 705, + "end": 715, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 706, + "end": 714, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 706, + "end": 714, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "typeParams": null + } + ] + } + } + } + } + } + ], + "decorators": [], + "span": { + "start": 650, + "end": 723, + "ctxt": 0 + }, + "body": null, + "generator": false, + "async": false, + "typeParameters": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 680, + "end": 690, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 681, + "end": 689, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 681, + "end": 689, + "ctxt": 0 + }, + "value": "TContext", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": null, + "default": null + } + ] + }, + "returnType": { + "type": "TsTypeAnnotation", + "span": { + "start": 716, + "end": 722, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 718, + "end": 722, + "ctxt": 0 + }, + "kind": "void" + } + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 725, + "end": 871, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 725, + "end": 870, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 725, + "end": 738, + "ctxt": 0 + }, + "value": "createMachine", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "ObjectExpression", + "span": { + "start": 758, + "end": 869, + "ctxt": 0 + }, + "properties": [ + { + "type": "KeyValueProperty", + "key": { + "type": "Identifier", + "span": { + "start": 762, + "end": 769, + "ctxt": 0 + }, + "value": "context", + "optional": false + }, + "value": { + "type": "ObjectExpression", + "span": { + "start": 771, + "end": 790, + "ctxt": 0 + }, + "properties": [ + { + "type": "KeyValueProperty", + "key": { + "type": "Identifier", + "span": { + "start": 777, + "end": 782, + "ctxt": 0 + }, + "value": "count", + "optional": false + }, + "value": { + "type": "NumericLiteral", + "span": { + "start": 784, + "end": 785, + "ctxt": 0 + }, + "value": 0.0, + "raw": "0" + } + } + ] + } + }, + { + "type": "KeyValueProperty", + "key": { + "type": "Identifier", + "span": { + "start": 794, + "end": 799, + "ctxt": 0 + }, + "value": "entry", + "optional": false + }, + "value": { + "type": "CallExpression", + "span": { + "start": 801, + "end": 866, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 801, + "end": 807, + "ctxt": 0 + }, + "value": "assign", + "optional": false + }, + "arguments": [ + { + "spread": null, + "expression": { + "type": "ObjectExpression", + "span": { + "start": 808, + "end": 865, + "ctxt": 0 + }, + "properties": [ + { + "type": "KeyValueProperty", + "key": { + "type": "Identifier", + "span": { + "start": 814, + "end": 819, + "ctxt": 0 + }, + "value": "count", + "optional": false + }, + "value": { + "type": "ArrowFunctionExpression", + "span": { + "start": 821, + "end": 860, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 822, + "end": 844, + "ctxt": 0 + }, + "value": "ctx", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 825, + "end": 844, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeLiteral", + "span": { + "start": 827, + "end": 844, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 829, + "end": 842, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 829, + "end": 834, + "ctxt": 0 + }, + "value": "count", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 834, + "end": 842, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 836, + "end": 842, + "ctxt": 0 + }, + "kind": "number" + } + }, + "typeParams": null + } + ] + } + } + } + ], + "body": { + "type": "UpdateExpression", + "span": { + "start": 849, + "end": 860, + "ctxt": 0 + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "MemberExpression", + "span": { + "start": 851, + "end": 860, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 851, + "end": 854, + "ctxt": 0 + }, + "value": "ctx", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 855, + "end": 860, + "ctxt": 0 + }, + "value": "count", + "optional": false + } + } + }, + "async": false, + "generator": false, + "typeParameters": null, + "returnType": null + } + } + ] + } + } + ], + "typeArguments": null + } + } + ] + } + } + ], + "typeArguments": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 738, + "end": 757, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeLiteral", + "span": { + "start": 739, + "end": 756, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 741, + "end": 754, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 741, + "end": 746, + "ctxt": 0 + }, + "value": "count", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 746, + "end": 754, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 748, + "end": 754, + "ctxt": 0 + }, + "kind": "number" + } + }, + "typeParams": null + } + ] + } + ] + } + } + } + ], + "interpreter": null +} diff --git a/crates/swc_ecma_parser/tests/tsc/genericContextualTypes3.ts b/crates/swc_ecma_parser/tests/tsc/genericContextualTypes3.ts new file mode 100644 index 000000000000..4ad859a21974 --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/genericContextualTypes3.ts @@ -0,0 +1,41 @@ +// @strict: true +// @noEmit: true + +type LowInfer = T & {}; + +type PartialAssigner = ( + context: TContext +) => TContext[TKey]; + +type PropertyAssigner = { + [K in keyof TContext]?: PartialAssigner | TContext[K]; +}; + +type Meta = { + action: (ctx: TContext) => void +} + +interface AssignAction { + type: "xstate.assign"; + (arg: TContext, meta: Meta): void; +} + +declare function assign( + assignment: PropertyAssigner> +): AssignAction; + +type Config = { + context: TContext; + entry?: AssignAction; +}; + +declare function createMachine(config: Config): void; + +createMachine<{ count: number }>({ + context: { + count: 0, + }, + entry: assign({ + count: (ctx: { count: number }) => ++ctx.count, + }), +}); diff --git a/crates/swc_ecma_parser/tests/tsc/intraExpressionInferencesJsx.tsx b/crates/swc_ecma_parser/tests/tsc/intraExpressionInferencesJsx.tsx new file mode 100644 index 000000000000..4ecd4f9e4b62 --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/intraExpressionInferencesJsx.tsx @@ -0,0 +1,112 @@ +// @strict: true +// @jsx: react-jsx +// @noEmit: true + +/// + +// repro from #52798 + +type A = { + a: boolean; +}; + +type B = { + b: string; +}; + +type C = { + c: number; +}; + +type Animations = { + [key: string]: { value: number } & ( + | ({ kind: "a"; func?(): Partial } & A) + | ({ kind: "b"; func?(): Partial } & B) + | ({ kind: "c"; func?(): Partial } & C) + ); +}; + +type StyleParam = Record; + +type AnimatedViewProps = { + style: (animationsValues: StyleParam) => string; + animations: T; +}; + +const Component = ({ + animations, + style, +}: AnimatedViewProps) => <>; + + { + return ""; + }} +/>; + { + return ""; + }} +/>; + { + return { + a: true, + }; + }, + }, + }} + style={(anim) => { + return ""; + }} +/>; + +// repro from #52786 + +interface Props { + a: (x: string) => T; + b: (arg: T) => void; +} + +function Foo(props: Props) { + return
; +} + + 10} + b={(arg) => { arg.toString(); }} +/>; + + 10} + b={(arg) => { arg.toString(); }} +/>; + + 10, + b: (arg) => { arg.toString(); }, +}} />; diff --git a/crates/swc_ecma_parser/tests/tsc/jsDeclarationsClassStatic2.json b/crates/swc_ecma_parser/tests/tsc/jsDeclarationsClassStatic2.json new file mode 100644 index 000000000000..096bfa9f912e --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/jsDeclarationsClassStatic2.json @@ -0,0 +1,306 @@ +{ + "type": "Module", + "span": { + "start": 129, + "end": 309, + "ctxt": 0 + }, + "body": [ + { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 135, + "end": 139, + "ctxt": 0 + }, + "value": "Base", + "optional": false + }, + "declare": false, + "span": { + "start": 129, + "end": 162, + "ctxt": 0 + }, + "decorators": [], + "body": [ + { + "type": "ClassProperty", + "span": { + "start": 144, + "end": 160, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 151, + "end": 154, + "ctxt": 0 + }, + "value": "foo", + "optional": false + }, + "value": { + "type": "StringLiteral", + "span": { + "start": 157, + "end": 159, + "ctxt": 0 + }, + "value": "", + "raw": "\"\"" + }, + "typeAnnotation": null, + "isStatic": true, + "decorators": [], + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false, + "readonly": false, + "declare": false, + "definite": false + } + ], + "superClass": null, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + }, + { + "type": "ExportDeclaration", + "span": { + "start": 163, + "end": 195, + "ctxt": 0 + }, + "declaration": { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 176, + "end": 179, + "ctxt": 0 + }, + "value": "Foo", + "optional": false + }, + "declare": false, + "span": { + "start": 170, + "end": 195, + "ctxt": 0 + }, + "decorators": [], + "body": [], + "superClass": { + "type": "Identifier", + "span": { + "start": 188, + "end": 192, + "ctxt": 0 + }, + "value": "Base", + "optional": false + }, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 196, + "end": 212, + "ctxt": 0 + }, + "expression": { + "type": "AssignmentExpression", + "span": { + "start": 196, + "end": 211, + "ctxt": 0 + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "span": { + "start": 196, + "end": 203, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 196, + "end": 199, + "ctxt": 0 + }, + "value": "Foo", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 200, + "end": 203, + "ctxt": 0 + }, + "value": "foo", + "optional": false + } + }, + "right": { + "type": "StringLiteral", + "span": { + "start": 206, + "end": 211, + "ctxt": 0 + }, + "value": "foo", + "raw": "\"foo\"" + } + } + }, + { + "type": "ImportDeclaration", + "span": { + "start": 235, + "end": 266, + "ctxt": 0 + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "span": { + "start": 244, + "end": 247, + "ctxt": 0 + }, + "local": { + "type": "Identifier", + "span": { + "start": 244, + "end": 247, + "ctxt": 0 + }, + "value": "Foo", + "optional": false + }, + "imported": null, + "isTypeOnly": false + } + ], + "source": { + "type": "StringLiteral", + "span": { + "start": 255, + "end": 265, + "ctxt": 0 + }, + "value": "./Foo.js", + "raw": "\"./Foo.js\"" + }, + "typeOnly": false, + "asserts": null + }, + { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 274, + "end": 277, + "ctxt": 0 + }, + "value": "Bar", + "optional": false + }, + "declare": false, + "span": { + "start": 268, + "end": 292, + "ctxt": 0 + }, + "decorators": [], + "body": [], + "superClass": { + "type": "Identifier", + "span": { + "start": 286, + "end": 289, + "ctxt": 0 + }, + "value": "Foo", + "optional": false + }, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + }, + { + "type": "ExpressionStatement", + "span": { + "start": 293, + "end": 309, + "ctxt": 0 + }, + "expression": { + "type": "AssignmentExpression", + "span": { + "start": 293, + "end": 308, + "ctxt": 0 + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "span": { + "start": 293, + "end": 300, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 293, + "end": 296, + "ctxt": 0 + }, + "value": "Bar", + "optional": false + }, + "property": { + "type": "Identifier", + "span": { + "start": 297, + "end": 300, + "ctxt": 0 + }, + "value": "foo", + "optional": false + } + }, + "right": { + "type": "StringLiteral", + "span": { + "start": 303, + "end": 308, + "ctxt": 0 + }, + "value": "foo", + "raw": "\"foo\"" + } + } + } + ], + "interpreter": null +} diff --git a/crates/swc_ecma_parser/tests/tsc/jsDeclarationsClassStatic2.ts b/crates/swc_ecma_parser/tests/tsc/jsDeclarationsClassStatic2.ts new file mode 100644 index 000000000000..6d1beb25fd81 --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/jsDeclarationsClassStatic2.ts @@ -0,0 +1,17 @@ +// @allowJs: true +// @checkJs: true +// @declaration: true +// @emitDeclarationOnly: true +// @outDir: ./out/ +// @filename: Foo.js +class Base { + static foo = ""; +} +export class Foo extends Base {} +Foo.foo = "foo"; + +// @filename: Bar.ts +import { Foo } from "./Foo.js"; + +class Bar extends Foo {} +Bar.foo = "foo"; diff --git a/crates/swc_ecma_parser/tests/tsc/mappedTypeConstraints2.json b/crates/swc_ecma_parser/tests/tsc/mappedTypeConstraints2.json index a0fb04e58dbe..9add3598601f 100644 --- a/crates/swc_ecma_parser/tests/tsc/mappedTypeConstraints2.json +++ b/crates/swc_ecma_parser/tests/tsc/mappedTypeConstraints2.json @@ -2,7 +2,7 @@ "type": "Script", "span": { "start": 60, - "end": 1370, + "end": 1656, "ctxt": 0 }, "body": [ @@ -3201,6 +3201,517 @@ ] }, "returnType": null + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 1394, + "end": 1480, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 1399, + "end": 1424, + "ctxt": 0 + }, + "value": "ObjectWithUnderscoredKeys", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 1424, + "end": 1442, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 1425, + "end": 1441, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 1425, + "end": 1426, + "ctxt": 0 + }, + "value": "K", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsKeywordType", + "span": { + "start": 1435, + "end": 1441, + "ctxt": 0 + }, + "kind": "string" + }, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsMappedType", + "span": { + "start": 1445, + "end": 1479, + "ctxt": 0 + }, + "readonly": null, + "typeParam": { + "type": "TsTypeParameter", + "span": { + "start": 1452, + "end": 1458, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 1452, + "end": 1453, + "ctxt": 0 + }, + "value": "k", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsTypeReference", + "span": { + "start": 1457, + "end": 1458, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 1457, + "end": 1458, + "ctxt": 0 + }, + "value": "K", + "optional": false + }, + "typeParams": null + }, + "default": null + }, + "nameType": { + "type": "TsLiteralType", + "span": { + "start": 1462, + "end": 1469, + "ctxt": 0 + }, + "literal": { + "type": "TemplateLiteral", + "span": { + "start": 1462, + "end": 1469, + "ctxt": 0 + }, + "types": [ + { + "type": "TsTypeReference", + "span": { + "start": 1466, + "end": 1467, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 1466, + "end": 1467, + "ctxt": 0 + }, + "value": "k", + "optional": false + }, + "typeParams": null + } + ], + "quasis": [ + { + "type": "TemplateElement", + "span": { + "start": 1463, + "end": 1464, + "ctxt": 0 + }, + "tail": false, + "cooked": "_", + "raw": "_" + }, + { + "type": "TemplateElement", + "span": { + "start": 1468, + "end": 1468, + "ctxt": 0 + }, + "tail": true, + "cooked": "", + "raw": "" + } + ] + } + }, + "optional": null, + "typeAnnotation": { + "type": "TsLiteralType", + "span": { + "start": 1472, + "end": 1476, + "ctxt": 0 + }, + "literal": { + "type": "BooleanLiteral", + "span": { + "start": 1472, + "end": 1476, + "ctxt": 0 + }, + "value": true + } + } + } + }, + { + "type": "FunctionDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 1491, + "end": 1502, + "ctxt": 0 + }, + "value": "genericTest", + "optional": false + }, + "declare": false, + "params": [ + { + "type": "Parameter", + "span": { + "start": 1521, + "end": 1576, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 1521, + "end": 1576, + "ctxt": 0 + }, + "value": "objectWithUnderscoredKeys", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 1546, + "end": 1576, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 1548, + "end": 1576, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 1548, + "end": 1573, + "ctxt": 0 + }, + "value": "ObjectWithUnderscoredKeys", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 1573, + "end": 1576, + "ctxt": 0 + }, + "params": [ + { + "type": "TsTypeReference", + "span": { + "start": 1574, + "end": 1575, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 1574, + "end": 1575, + "ctxt": 0 + }, + "value": "K", + "optional": false + }, + "typeParams": null + } + ] + } + } + } + } + }, + { + "type": "Parameter", + "span": { + "start": 1578, + "end": 1584, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 1578, + "end": 1584, + "ctxt": 0 + }, + "value": "key", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 1581, + "end": 1584, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 1583, + "end": 1584, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 1583, + "end": 1584, + "ctxt": 0 + }, + "value": "K", + "optional": false + }, + "typeParams": null + } + } + } + } + ], + "decorators": [], + "span": { + "start": 1482, + "end": 1656, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 1586, + "end": 1656, + "ctxt": 0 + }, + "stmts": [ + { + "type": "VariableDeclaration", + "span": { + "start": 1590, + "end": 1654, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 1596, + "end": 1653, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 1596, + "end": 1608, + "ctxt": 0 + }, + "value": "shouldBeTrue", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 1608, + "end": 1614, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsLiteralType", + "span": { + "start": 1610, + "end": 1614, + "ctxt": 0 + }, + "literal": { + "type": "BooleanLiteral", + "span": { + "start": 1610, + "end": 1614, + "ctxt": 0 + }, + "value": true + } + } + } + }, + "init": { + "type": "MemberExpression", + "span": { + "start": 1617, + "end": 1653, + "ctxt": 0 + }, + "object": { + "type": "Identifier", + "span": { + "start": 1617, + "end": 1642, + "ctxt": 0 + }, + "value": "objectWithUnderscoredKeys", + "optional": false + }, + "property": { + "type": "Computed", + "span": { + "start": 1642, + "end": 1653, + "ctxt": 0 + }, + "expression": { + "type": "TemplateLiteral", + "span": { + "start": 1643, + "end": 1652, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Identifier", + "span": { + "start": 1647, + "end": 1650, + "ctxt": 0 + }, + "value": "key", + "optional": false + } + ], + "quasis": [ + { + "type": "TemplateElement", + "span": { + "start": 1644, + "end": 1645, + "ctxt": 0 + }, + "tail": false, + "cooked": "_", + "raw": "_" + }, + { + "type": "TemplateElement", + "span": { + "start": 1651, + "end": 1651, + "ctxt": 0 + }, + "tail": true, + "cooked": "", + "raw": "" + } + ] + } + } + }, + "definite": false + } + ] + } + ] + }, + "generator": false, + "async": false, + "typeParameters": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 1502, + "end": 1520, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 1503, + "end": 1519, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 1503, + "end": 1504, + "ctxt": 0 + }, + "value": "K", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsKeywordType", + "span": { + "start": 1513, + "end": 1519, + "ctxt": 0 + }, + "kind": "string" + }, + "default": null + } + ] + }, + "returnType": null } ], "interpreter": null diff --git a/crates/swc_ecma_parser/tests/tsc/mappedTypeConstraints2.ts b/crates/swc_ecma_parser/tests/tsc/mappedTypeConstraints2.ts index ed08d53d8f7e..f339f283a633 100644 --- a/crates/swc_ecma_parser/tests/tsc/mappedTypeConstraints2.ts +++ b/crates/swc_ecma_parser/tests/tsc/mappedTypeConstraints2.ts @@ -49,3 +49,13 @@ function validate(obj: T, bounds: NumericBoundsOf) { } return true; } + +// repro from #50030 + +type ObjectWithUnderscoredKeys = { + [k in K as `_${k}`]: true; +}; + +function genericTest(objectWithUnderscoredKeys: ObjectWithUnderscoredKeys, key: K) { + const shouldBeTrue: true = objectWithUnderscoredKeys[`_${key}`]; +} diff --git a/crates/swc_ecma_parser/tests/tsc/mappedTypeRelationships.json b/crates/swc_ecma_parser/tests/tsc/mappedTypeRelationships.json index df14be73bbba..a4ec54a0f6e8 100644 --- a/crates/swc_ecma_parser/tests/tsc/mappedTypeRelationships.json +++ b/crates/swc_ecma_parser/tests/tsc/mappedTypeRelationships.json @@ -2,7 +2,7 @@ "type": "Script", "span": { "start": 51, - "end": 3961, + "end": 4528, "ctxt": 0 }, "body": [ @@ -14372,6 +14372,916 @@ } } } + }, + { + "type": "TsInterfaceDeclaration", + "span": { + "start": 3973, + "end": 4076, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 3983, + "end": 3996, + "ctxt": 0 + }, + "value": "SettingsTypes", + "optional": false + }, + "declare": false, + "typeParams": null, + "extends": [], + "body": { + "type": "TsInterfaceBody", + "span": { + "start": 3997, + "end": 4076, + "ctxt": 0 + }, + "body": [ + { + "type": "TsPropertySignature", + "span": { + "start": 4001, + "end": 4034, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 4001, + "end": 4006, + "ctxt": 0 + }, + "value": "audio", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 4006, + "end": 4033, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeLiteral", + "span": { + "start": 4008, + "end": 4033, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 4014, + "end": 4029, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 4014, + "end": 4020, + "ctxt": 0 + }, + "value": "volume", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 4020, + "end": 4028, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 4022, + "end": 4028, + "ctxt": 0 + }, + "kind": "string" + } + }, + "typeParams": null + } + ] + } + }, + "typeParams": null + }, + { + "type": "TsPropertySignature", + "span": { + "start": 4037, + "end": 4074, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 4037, + "end": 4042, + "ctxt": 0 + }, + "value": "video", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 4042, + "end": 4073, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeLiteral", + "span": { + "start": 4044, + "end": 4073, + "ctxt": 0 + }, + "members": [ + { + "type": "TsPropertySignature", + "span": { + "start": 4050, + "end": 4069, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 4050, + "end": 4060, + "ctxt": 0 + }, + "value": "resolution", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 4060, + "end": 4068, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 4062, + "end": 4068, + "ctxt": 0 + }, + "kind": "string" + } + }, + "typeParams": null + } + ] + } + }, + "typeParams": null + } + ] + } + }, + { + "type": "TsInterfaceDeclaration", + "span": { + "start": 4077, + "end": 4166, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 4087, + "end": 4095, + "ctxt": 0 + }, + "value": "Settings", + "optional": false + }, + "declare": false, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 4095, + "end": 4144, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 4096, + "end": 4143, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 4096, + "end": 4102, + "ctxt": 0 + }, + "value": "Params", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsMappedType", + "span": { + "start": 4111, + "end": 4143, + "ctxt": 0 + }, + "readonly": null, + "typeParam": { + "type": "TsTypeParameter", + "span": { + "start": 4114, + "end": 4131, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 4114, + "end": 4115, + "ctxt": 0 + }, + "value": "K", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsTypeOperator", + "span": { + "start": 4119, + "end": 4131, + "ctxt": 0 + }, + "op": "keyof", + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 4125, + "end": 4131, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 4125, + "end": 4131, + "ctxt": 0 + }, + "value": "Params", + "optional": false + }, + "typeParams": null + } + }, + "default": null + }, + "nameType": null, + "optional": true, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 4135, + "end": 4141, + "ctxt": 0 + }, + "kind": "string" + } + }, + "default": null + } + ] + }, + "extends": [], + "body": { + "type": "TsInterfaceBody", + "span": { + "start": 4145, + "end": 4166, + "ctxt": 0 + }, + "body": [ + { + "type": "TsPropertySignature", + "span": { + "start": 4149, + "end": 4164, + "ctxt": 0 + }, + "readonly": false, + "key": { + "type": "Identifier", + "span": { + "start": 4149, + "end": 4155, + "ctxt": 0 + }, + "value": "config", + "optional": false + }, + "computed": false, + "optional": false, + "init": null, + "params": [], + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 4155, + "end": 4163, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 4157, + "end": 4163, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 4157, + "end": 4163, + "ctxt": 0 + }, + "value": "Params", + "optional": false + }, + "typeParams": null + } + }, + "typeParams": null + } + ] + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 4167, + "end": 4231, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 4172, + "end": 4195, + "ctxt": 0 + }, + "value": "ConcreteSettingsResult1", + "optional": false + }, + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 4198, + "end": 4230, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 4198, + "end": 4206, + "ctxt": 0 + }, + "value": "Settings", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 4206, + "end": 4230, + "ctxt": 0 + }, + "params": [ + { + "type": "TsIndexedAccessType", + "span": { + "start": 4207, + "end": 4229, + "ctxt": 0 + }, + "readonly": false, + "objectType": { + "type": "TsTypeReference", + "span": { + "start": 4207, + "end": 4220, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 4207, + "end": 4220, + "ctxt": 0 + }, + "value": "SettingsTypes", + "optional": false + }, + "typeParams": null + }, + "indexType": { + "type": "TsLiteralType", + "span": { + "start": 4221, + "end": 4228, + "ctxt": 0 + }, + "literal": { + "type": "StringLiteral", + "span": { + "start": 4221, + "end": 4228, + "ctxt": 0 + }, + "value": "audio", + "raw": "\"audio\"" + } + } + } + ] + } + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 4232, + "end": 4306, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 4237, + "end": 4260, + "ctxt": 0 + }, + "value": "ConcreteSettingsResult2", + "optional": false + }, + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 4263, + "end": 4305, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 4263, + "end": 4271, + "ctxt": 0 + }, + "value": "Settings", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 4271, + "end": 4305, + "ctxt": 0 + }, + "params": [ + { + "type": "TsIndexedAccessType", + "span": { + "start": 4272, + "end": 4304, + "ctxt": 0 + }, + "readonly": false, + "objectType": { + "type": "TsTypeReference", + "span": { + "start": 4272, + "end": 4285, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 4272, + "end": 4285, + "ctxt": 0 + }, + "value": "SettingsTypes", + "optional": false + }, + "typeParams": null + }, + "indexType": { + "type": "TsUnionType", + "span": { + "start": 4286, + "end": 4303, + "ctxt": 0 + }, + "types": [ + { + "type": "TsLiteralType", + "span": { + "start": 4286, + "end": 4293, + "ctxt": 0 + }, + "literal": { + "type": "StringLiteral", + "span": { + "start": 4286, + "end": 4293, + "ctxt": 0 + }, + "value": "audio", + "raw": "\"audio\"" + } + }, + { + "type": "TsLiteralType", + "span": { + "start": 4296, + "end": 4303, + "ctxt": 0 + }, + "literal": { + "type": "StringLiteral", + "span": { + "start": 4296, + "end": 4303, + "ctxt": 0 + }, + "value": "video", + "raw": "\"video\"" + } + } + ] + } + } + ] + } + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 4307, + "end": 4394, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 4312, + "end": 4333, + "ctxt": 0 + }, + "value": "GenericSettingsAccess", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 4333, + "end": 4364, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 4334, + "end": 4363, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 4334, + "end": 4335, + "ctxt": 0 + }, + "value": "T", + "optional": false + }, + "in": false, + "out": false, + "const": false, + "constraint": { + "type": "TsTypeOperator", + "span": { + "start": 4344, + "end": 4363, + "ctxt": 0 + }, + "op": "keyof", + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 4350, + "end": 4363, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 4350, + "end": 4363, + "ctxt": 0 + }, + "value": "SettingsTypes", + "optional": false + }, + "typeParams": null + } + }, + "default": null + } + ] + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 4367, + "end": 4393, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 4367, + "end": 4375, + "ctxt": 0 + }, + "value": "Settings", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 4375, + "end": 4393, + "ctxt": 0 + }, + "params": [ + { + "type": "TsIndexedAccessType", + "span": { + "start": 4376, + "end": 4392, + "ctxt": 0 + }, + "readonly": false, + "objectType": { + "type": "TsTypeReference", + "span": { + "start": 4376, + "end": 4389, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 4376, + "end": 4389, + "ctxt": 0 + }, + "value": "SettingsTypes", + "optional": false + }, + "typeParams": null + }, + "indexType": { + "type": "TsTypeReference", + "span": { + "start": 4390, + "end": 4391, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 4390, + "end": 4391, + "ctxt": 0 + }, + "value": "T", + "optional": false + }, + "typeParams": null + } + } + ] + } + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 4395, + "end": 4456, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 4400, + "end": 4422, + "ctxt": 0 + }, + "value": "GenericSettingsResult1", + "optional": false + }, + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 4425, + "end": 4455, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 4425, + "end": 4446, + "ctxt": 0 + }, + "value": "GenericSettingsAccess", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 4446, + "end": 4455, + "ctxt": 0 + }, + "params": [ + { + "type": "TsLiteralType", + "span": { + "start": 4447, + "end": 4454, + "ctxt": 0 + }, + "literal": { + "type": "StringLiteral", + "span": { + "start": 4447, + "end": 4454, + "ctxt": 0 + }, + "value": "audio", + "raw": "\"audio\"" + } + } + ] + } + } + }, + { + "type": "TsTypeAliasDeclaration", + "span": { + "start": 4457, + "end": 4528, + "ctxt": 0 + }, + "declare": false, + "id": { + "type": "Identifier", + "span": { + "start": 4462, + "end": 4484, + "ctxt": 0 + }, + "value": "GenericSettingsResult2", + "optional": false + }, + "typeParams": null, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 4487, + "end": 4527, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 4487, + "end": 4508, + "ctxt": 0 + }, + "value": "GenericSettingsAccess", + "optional": false + }, + "typeParams": { + "type": "TsTypeParameterInstantiation", + "span": { + "start": 4508, + "end": 4527, + "ctxt": 0 + }, + "params": [ + { + "type": "TsUnionType", + "span": { + "start": 4509, + "end": 4526, + "ctxt": 0 + }, + "types": [ + { + "type": "TsLiteralType", + "span": { + "start": 4509, + "end": 4516, + "ctxt": 0 + }, + "literal": { + "type": "StringLiteral", + "span": { + "start": 4509, + "end": 4516, + "ctxt": 0 + }, + "value": "audio", + "raw": "\"audio\"" + } + }, + { + "type": "TsLiteralType", + "span": { + "start": 4519, + "end": 4526, + "ctxt": 0 + }, + "literal": { + "type": "StringLiteral", + "span": { + "start": 4519, + "end": 4526, + "ctxt": 0 + }, + "value": "video", + "raw": "\"video\"" + } + } + ] + } + ] + } + } } ], "interpreter": null diff --git a/crates/swc_ecma_parser/tests/tsc/mappedTypeRelationships.ts b/crates/swc_ecma_parser/tests/tsc/mappedTypeRelationships.ts index f3f982e7942b..f7c666d94510 100644 --- a/crates/swc_ecma_parser/tests/tsc/mappedTypeRelationships.ts +++ b/crates/swc_ecma_parser/tests/tsc/mappedTypeRelationships.ts @@ -192,3 +192,21 @@ function f90() { function f(): Partial { return undefined! as T; } + +// #32365 +interface SettingsTypes { + audio: { + volume: string; + }; + video: { + resolution: string; + }; +} +interface Settings { + config: Params; +} +type ConcreteSettingsResult1 = Settings; +type ConcreteSettingsResult2 = Settings; +type GenericSettingsAccess = Settings; +type GenericSettingsResult1 = GenericSettingsAccess<"audio">; +type GenericSettingsResult2 = GenericSettingsAccess<"audio" | "video">; \ No newline at end of file diff --git a/crates/swc_ecma_parser/tests/tsc/overloadTag3.json b/crates/swc_ecma_parser/tests/tsc/overloadTag3.json new file mode 100644 index 000000000000..60eba96b8a18 --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/overloadTag3.json @@ -0,0 +1,224 @@ +{ + "type": "Module", + "span": { + "start": 114, + "end": 323, + "ctxt": 0 + }, + "body": [ + { + "type": "ExportDeclaration", + "span": { + "start": 114, + "end": 269, + "ctxt": 0 + }, + "declaration": { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 127, + "end": 130, + "ctxt": 0 + }, + "value": "Foo", + "optional": false + }, + "declare": false, + "span": { + "start": 121, + "end": 269, + "ctxt": 0 + }, + "decorators": [], + "body": [ + { + "type": "Constructor", + "span": { + "start": 190, + "end": 207, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 190, + "end": 201, + "ctxt": 0 + }, + "value": "constructor", + "optional": false + }, + "params": [], + "body": { + "type": "BlockStatement", + "span": { + "start": 204, + "end": 207, + "ctxt": 0 + }, + "stmts": [] + }, + "accessibility": null, + "isOptional": false + }, + { + "type": "ClassMethod", + "span": { + "start": 253, + "end": 267, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 253, + "end": 256, + "ctxt": 0 + }, + "value": "bar", + "optional": false + }, + "function": { + "params": [ + { + "type": "Parameter", + "span": { + "start": 257, + "end": 262, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 257, + "end": 262, + "ctxt": 0 + }, + "value": "value", + "optional": false, + "typeAnnotation": null + } + } + ], + "decorators": [], + "span": { + "start": 253, + "end": 267, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 264, + "end": 267, + "ctxt": 0 + }, + "stmts": [] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": null + }, + "kind": "method", + "isStatic": false, + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false + } + ], + "superClass": null, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + } + }, + { + "type": "VariableDeclaration", + "span": { + "start": 298, + "end": 306, + "ctxt": 0 + }, + "kind": "let", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 302, + "end": 305, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 302, + "end": 305, + "ctxt": 0 + }, + "value": "foo", + "optional": false, + "typeAnnotation": null + }, + "init": null, + "definite": false + } + ] + }, + { + "type": "ExpressionStatement", + "span": { + "start": 307, + "end": 323, + "ctxt": 0 + }, + "expression": { + "type": "AssignmentExpression", + "span": { + "start": 307, + "end": 322, + "ctxt": 0 + }, + "operator": "=", + "left": { + "type": "Identifier", + "span": { + "start": 307, + "end": 310, + "ctxt": 0 + }, + "value": "foo", + "optional": false, + "typeAnnotation": null + }, + "right": { + "type": "NewExpression", + "span": { + "start": 313, + "end": 322, + "ctxt": 0 + }, + "callee": { + "type": "Identifier", + "span": { + "start": 317, + "end": 320, + "ctxt": 0 + }, + "value": "Foo", + "optional": false + }, + "arguments": [], + "typeArguments": null + } + } + } + ], + "interpreter": null +} diff --git a/crates/swc_ecma_parser/tests/tsc/overloadTag3.ts b/crates/swc_ecma_parser/tests/tsc/overloadTag3.ts new file mode 100644 index 000000000000..999184d4263e --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/overloadTag3.ts @@ -0,0 +1,24 @@ +// @checkJs: true +// @allowJs: true +// @strict: true +// @noEmit: true +// @filename: /a.js +/** + * @template T + */ +export class Foo { + /** + * @constructor + * @overload + */ + constructor() { } + + /** + * @param {T} value + */ + bar(value) { } +} + +/** @type {Foo} */ +let foo; +foo = new Foo(); diff --git a/crates/swc_ecma_parser/tests/tsc/privateNameFieldParenthesisLeftAssignment.json b/crates/swc_ecma_parser/tests/tsc/privateNameFieldParenthesisLeftAssignment.json new file mode 100644 index 000000000000..f379d0f2cad5 --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/privateNameFieldParenthesisLeftAssignment.json @@ -0,0 +1,896 @@ +{ + "type": "Script", + "span": { + "start": 21, + "end": 343, + "ctxt": 0 + }, + "body": [ + { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 27, + "end": 30, + "ctxt": 0 + }, + "value": "Foo", + "optional": false + }, + "declare": false, + "span": { + "start": 21, + "end": 343, + "ctxt": 0 + }, + "decorators": [], + "body": [ + { + "type": "PrivateProperty", + "span": { + "start": 37, + "end": 48, + "ctxt": 0 + }, + "key": { + "type": "PrivateName", + "span": { + "start": 37, + "end": 39, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 38, + "end": 39, + "ctxt": 0 + }, + "value": "p", + "optional": false + } + }, + "value": null, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 39, + "end": 47, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 41, + "end": 47, + "ctxt": 0 + }, + "kind": "number" + } + }, + "isStatic": false, + "decorators": [], + "accessibility": null, + "isOptional": false, + "isOverride": false, + "readonly": false, + "definite": false + }, + { + "type": "Constructor", + "span": { + "start": 54, + "end": 113, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 54, + "end": 65, + "ctxt": 0 + }, + "value": "constructor", + "optional": false + }, + "params": [ + { + "type": "Parameter", + "span": { + "start": 66, + "end": 79, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 66, + "end": 79, + "ctxt": 0 + }, + "value": "value", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 71, + "end": 79, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 73, + "end": 79, + "ctxt": 0 + }, + "kind": "number" + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "span": { + "start": 81, + "end": 113, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ExpressionStatement", + "span": { + "start": 91, + "end": 107, + "ctxt": 0 + }, + "expression": { + "type": "AssignmentExpression", + "span": { + "start": 91, + "end": 106, + "ctxt": 0 + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "span": { + "start": 91, + "end": 98, + "ctxt": 0 + }, + "object": { + "type": "ThisExpression", + "span": { + "start": 91, + "end": 95, + "ctxt": 0 + } + }, + "property": { + "type": "PrivateName", + "span": { + "start": 96, + "end": 98, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 97, + "end": 98, + "ctxt": 0 + }, + "value": "p", + "optional": false + } + } + }, + "right": { + "type": "Identifier", + "span": { + "start": 101, + "end": 106, + "ctxt": 0 + }, + "value": "value", + "optional": false + } + } + } + ] + }, + "accessibility": null, + "isOptional": false + }, + { + "type": "ClassMethod", + "span": { + "start": 119, + "end": 173, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 119, + "end": 121, + "ctxt": 0 + }, + "value": "t1", + "optional": false + }, + "function": { + "params": [ + { + "type": "Parameter", + "span": { + "start": 122, + "end": 131, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 122, + "end": 131, + "ctxt": 0 + }, + "value": "p", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 123, + "end": 131, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 125, + "end": 131, + "ctxt": 0 + }, + "kind": "number" + } + } + } + } + ], + "decorators": [], + "span": { + "start": 119, + "end": 173, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 133, + "end": 173, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ExpressionStatement", + "span": { + "start": 143, + "end": 167, + "ctxt": 0 + }, + "expression": { + "type": "AssignmentExpression", + "span": { + "start": 143, + "end": 166, + "ctxt": 0 + }, + "operator": "=", + "left": { + "type": "ParenthesisExpression", + "span": { + "start": 143, + "end": 162, + "ctxt": 0 + }, + "expression": { + "type": "TsAsExpression", + "span": { + "start": 144, + "end": 161, + "ctxt": 0 + }, + "expression": { + "type": "MemberExpression", + "span": { + "start": 144, + "end": 151, + "ctxt": 0 + }, + "object": { + "type": "ThisExpression", + "span": { + "start": 144, + "end": 148, + "ctxt": 0 + } + }, + "property": { + "type": "PrivateName", + "span": { + "start": 149, + "end": 151, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 150, + "end": 151, + "ctxt": 0 + }, + "value": "p", + "optional": false + } + } + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 155, + "end": 161, + "ctxt": 0 + }, + "kind": "number" + } + } + }, + "right": { + "type": "Identifier", + "span": { + "start": 165, + "end": 166, + "ctxt": 0 + }, + "value": "p", + "optional": false + } + } + } + ] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": null + }, + "kind": "method", + "isStatic": false, + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false + }, + { + "type": "ClassMethod", + "span": { + "start": 179, + "end": 237, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 179, + "end": 181, + "ctxt": 0 + }, + "value": "t2", + "optional": false + }, + "function": { + "params": [ + { + "type": "Parameter", + "span": { + "start": 182, + "end": 191, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 182, + "end": 191, + "ctxt": 0 + }, + "value": "p", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 183, + "end": 191, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 185, + "end": 191, + "ctxt": 0 + }, + "kind": "number" + } + } + } + } + ], + "decorators": [], + "span": { + "start": 179, + "end": 237, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 193, + "end": 237, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ExpressionStatement", + "span": { + "start": 203, + "end": 231, + "ctxt": 0 + }, + "expression": { + "type": "AssignmentExpression", + "span": { + "start": 203, + "end": 230, + "ctxt": 0 + }, + "operator": "=", + "left": { + "type": "ParenthesisExpression", + "span": { + "start": 203, + "end": 226, + "ctxt": 0 + }, + "expression": { + "type": "ParenthesisExpression", + "span": { + "start": 204, + "end": 225, + "ctxt": 0 + }, + "expression": { + "type": "ParenthesisExpression", + "span": { + "start": 205, + "end": 224, + "ctxt": 0 + }, + "expression": { + "type": "TsAsExpression", + "span": { + "start": 206, + "end": 223, + "ctxt": 0 + }, + "expression": { + "type": "MemberExpression", + "span": { + "start": 206, + "end": 213, + "ctxt": 0 + }, + "object": { + "type": "ThisExpression", + "span": { + "start": 206, + "end": 210, + "ctxt": 0 + } + }, + "property": { + "type": "PrivateName", + "span": { + "start": 211, + "end": 213, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 212, + "end": 213, + "ctxt": 0 + }, + "value": "p", + "optional": false + } + } + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 217, + "end": 223, + "ctxt": 0 + }, + "kind": "number" + } + } + } + } + }, + "right": { + "type": "Identifier", + "span": { + "start": 229, + "end": 230, + "ctxt": 0 + }, + "value": "p", + "optional": false + } + } + } + ] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": null + }, + "kind": "method", + "isStatic": false, + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false + }, + { + "type": "ClassMethod", + "span": { + "start": 243, + "end": 287, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 243, + "end": 245, + "ctxt": 0 + }, + "value": "t3", + "optional": false + }, + "function": { + "params": [ + { + "type": "Parameter", + "span": { + "start": 246, + "end": 255, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 246, + "end": 255, + "ctxt": 0 + }, + "value": "p", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 247, + "end": 255, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 249, + "end": 255, + "ctxt": 0 + }, + "kind": "number" + } + } + } + } + ], + "decorators": [], + "span": { + "start": 243, + "end": 287, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 257, + "end": 287, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ExpressionStatement", + "span": { + "start": 267, + "end": 281, + "ctxt": 0 + }, + "expression": { + "type": "AssignmentExpression", + "span": { + "start": 267, + "end": 280, + "ctxt": 0 + }, + "operator": "=", + "left": { + "type": "ParenthesisExpression", + "span": { + "start": 267, + "end": 276, + "ctxt": 0 + }, + "expression": { + "type": "MemberExpression", + "span": { + "start": 268, + "end": 275, + "ctxt": 0 + }, + "object": { + "type": "ThisExpression", + "span": { + "start": 268, + "end": 272, + "ctxt": 0 + } + }, + "property": { + "type": "PrivateName", + "span": { + "start": 273, + "end": 275, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 274, + "end": 275, + "ctxt": 0 + }, + "value": "p", + "optional": false + } + } + } + }, + "right": { + "type": "Identifier", + "span": { + "start": 279, + "end": 280, + "ctxt": 0 + }, + "value": "p", + "optional": false + } + } + } + ] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": null + }, + "kind": "method", + "isStatic": false, + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false + }, + { + "type": "ClassMethod", + "span": { + "start": 293, + "end": 341, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 293, + "end": 295, + "ctxt": 0 + }, + "value": "t4", + "optional": false + }, + "function": { + "params": [ + { + "type": "Parameter", + "span": { + "start": 296, + "end": 305, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 296, + "end": 305, + "ctxt": 0 + }, + "value": "p", + "optional": false, + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 297, + "end": 305, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsKeywordType", + "span": { + "start": 299, + "end": 305, + "ctxt": 0 + }, + "kind": "number" + } + } + } + } + ], + "decorators": [], + "span": { + "start": 293, + "end": 341, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 307, + "end": 341, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ExpressionStatement", + "span": { + "start": 317, + "end": 335, + "ctxt": 0 + }, + "expression": { + "type": "AssignmentExpression", + "span": { + "start": 317, + "end": 334, + "ctxt": 0 + }, + "operator": "=", + "left": { + "type": "ParenthesisExpression", + "span": { + "start": 317, + "end": 330, + "ctxt": 0 + }, + "expression": { + "type": "ParenthesisExpression", + "span": { + "start": 318, + "end": 329, + "ctxt": 0 + }, + "expression": { + "type": "ParenthesisExpression", + "span": { + "start": 319, + "end": 328, + "ctxt": 0 + }, + "expression": { + "type": "MemberExpression", + "span": { + "start": 320, + "end": 327, + "ctxt": 0 + }, + "object": { + "type": "ThisExpression", + "span": { + "start": 320, + "end": 324, + "ctxt": 0 + } + }, + "property": { + "type": "PrivateName", + "span": { + "start": 325, + "end": 327, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 326, + "end": 327, + "ctxt": 0 + }, + "value": "p", + "optional": false + } + } + } + } + } + }, + "right": { + "type": "Identifier", + "span": { + "start": 333, + "end": 334, + "ctxt": 0 + }, + "value": "p", + "optional": false + } + } + } + ] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": null + }, + "kind": "method", + "isStatic": false, + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false + } + ], + "superClass": null, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + } + ], + "interpreter": null +} diff --git a/crates/swc_ecma_parser/tests/tsc/privateNameFieldParenthesisLeftAssignment.ts b/crates/swc_ecma_parser/tests/tsc/privateNameFieldParenthesisLeftAssignment.ts new file mode 100644 index 000000000000..f0bcbaf06cf1 --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/privateNameFieldParenthesisLeftAssignment.ts @@ -0,0 +1,25 @@ +// @target: es2015 + +class Foo { + #p: number; + + constructor(value: number) { + this.#p = value; + } + + t1(p: number) { + (this.#p as number) = p; + } + + t2(p: number) { + (((this.#p as number))) = p; + } + + t3(p: number) { + (this.#p) = p; + } + + t4(p: number) { + (((this.#p))) = p; + } +} diff --git a/crates/swc_ecma_parser/tests/tsc/propertyAccessNumericLiterals.json b/crates/swc_ecma_parser/tests/tsc/propertyAccessNumericLiterals.json new file mode 100644 index 000000000000..aaa62f75dec1 --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/propertyAccessNumericLiterals.json @@ -0,0 +1,609 @@ +{ + "type": "Script", + "span": { + "start": 1, + "end": 244, + "ctxt": 0 + }, + "body": [ + { + "type": "ExpressionStatement", + "span": { + "start": 1, + "end": 23, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 1, + "end": 22, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 1, + "end": 20, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 1, + "end": 11, + "ctxt": 0 + }, + "value": 4294967295.0, + "raw": "0xffffffff" + }, + "property": { + "type": "Identifier", + "span": { + "start": 12, + "end": 20, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 24, + "end": 43, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 24, + "end": 42, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 24, + "end": 40, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 24, + "end": 31, + "ctxt": 0 + }, + "value": 668.0, + "raw": "0o01234" + }, + "property": { + "type": "Identifier", + "span": { + "start": 32, + "end": 40, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 44, + "end": 66, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 44, + "end": 65, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 44, + "end": 63, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 44, + "end": 54, + "ctxt": 0 + }, + "value": 109.0, + "raw": "0b01101101" + }, + "property": { + "type": "Identifier", + "span": { + "start": 55, + "end": 63, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 67, + "end": 84, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 67, + "end": 83, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 67, + "end": 81, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 67, + "end": 72, + "ctxt": 0 + }, + "value": 1234.0, + "raw": "1234." + }, + "property": { + "type": "Identifier", + "span": { + "start": 73, + "end": 81, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 85, + "end": 100, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 85, + "end": 99, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 85, + "end": 97, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 85, + "end": 88, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1e0" + }, + "property": { + "type": "Identifier", + "span": { + "start": 89, + "end": 97, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 101, + "end": 116, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 101, + "end": 115, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 101, + "end": 113, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 101, + "end": 104, + "ctxt": 0 + }, + "value": 0.0, + "raw": "000" + }, + "property": { + "type": "Identifier", + "span": { + "start": 105, + "end": 113, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 117, + "end": 135, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 117, + "end": 134, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 117, + "end": 132, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 117, + "end": 123, + "ctxt": 0 + }, + "value": 880000.0, + "raw": "08.8e5" + }, + "property": { + "type": "Identifier", + "span": { + "start": 124, + "end": 132, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 136, + "end": 155, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 136, + "end": 154, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 136, + "end": 152, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 136, + "end": 143, + "ctxt": 0 + }, + "value": 880000.0, + "raw": "0_8.8e5" + }, + "property": { + "type": "Identifier", + "span": { + "start": 144, + "end": 152, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 156, + "end": 173, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 156, + "end": 172, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 156, + "end": 170, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 156, + "end": 161, + "ctxt": 0 + }, + "value": 880000.0, + "raw": "8.8e5" + }, + "property": { + "type": "Identifier", + "span": { + "start": 162, + "end": 170, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 174, + "end": 191, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 174, + "end": 190, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 174, + "end": 188, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 174, + "end": 179, + "ctxt": 0 + }, + "value": 880000.0, + "raw": "088e4" + }, + "property": { + "type": "Identifier", + "span": { + "start": 180, + "end": 188, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 192, + "end": 209, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 192, + "end": 208, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 192, + "end": 206, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 192, + "end": 197, + "ctxt": 0 + }, + "value": 880000.0, + "raw": "88_e4" + }, + "property": { + "type": "Identifier", + "span": { + "start": 198, + "end": 206, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 210, + "end": 226, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 210, + "end": 225, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 210, + "end": 223, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 210, + "end": 214, + "ctxt": 0 + }, + "value": 880000.0, + "raw": "88e4" + }, + "property": { + "type": "Identifier", + "span": { + "start": 215, + "end": 223, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + }, + { + "type": "ExpressionStatement", + "span": { + "start": 227, + "end": 244, + "ctxt": 0 + }, + "expression": { + "type": "CallExpression", + "span": { + "start": 227, + "end": 243, + "ctxt": 0 + }, + "callee": { + "type": "MemberExpression", + "span": { + "start": 227, + "end": 241, + "ctxt": 0 + }, + "object": { + "type": "NumericLiteral", + "span": { + "start": 227, + "end": 232, + "ctxt": 0 + }, + "value": 880000.0, + "raw": "8_8e4" + }, + "property": { + "type": "Identifier", + "span": { + "start": 233, + "end": 241, + "ctxt": 0 + }, + "value": "toString", + "optional": false + } + }, + "arguments": [], + "typeArguments": null + } + } + ], + "interpreter": null +} diff --git a/crates/swc_ecma_parser/tests/tsc/propertyAccessNumericLiterals.ts b/crates/swc_ecma_parser/tests/tsc/propertyAccessNumericLiterals.ts new file mode 100644 index 000000000000..fa38c8673d8e --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/propertyAccessNumericLiterals.ts @@ -0,0 +1,13 @@ +0xffffffff.toString(); +0o01234.toString(); +0b01101101.toString(); +1234..toString(); +1e0.toString(); +000.toString(); +08.8e5.toString(); +0_8.8e5.toString(); +8.8e5.toString(); +088e4.toString(); +88_e4.toString(); +88e4.toString(); +8_8e4.toString(); \ No newline at end of file diff --git a/crates/swc_ecma_parser/tests/tsc/thisPropertyAssignmentInherited.json b/crates/swc_ecma_parser/tests/tsc/thisPropertyAssignmentInherited.json new file mode 100644 index 000000000000..985599dbdd4b --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/thisPropertyAssignmentInherited.json @@ -0,0 +1,576 @@ +{ + "type": "Module", + "span": { + "start": 137, + "end": 500, + "ctxt": 0 + }, + "body": [ + { + "type": "ExportDeclaration", + "span": { + "start": 137, + "end": 290, + "ctxt": 0 + }, + "declaration": { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 150, + "end": 157, + "ctxt": 0 + }, + "value": "Element", + "optional": false + }, + "declare": false, + "span": { + "start": 144, + "end": 290, + "ctxt": 0 + }, + "decorators": [], + "body": [ + { + "type": "ClassMethod", + "span": { + "start": 197, + "end": 235, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 201, + "end": 212, + "ctxt": 0 + }, + "value": "textContent", + "optional": false + }, + "function": { + "params": [], + "decorators": [], + "span": { + "start": 197, + "end": 235, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 215, + "end": 235, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ReturnStatement", + "span": { + "start": 221, + "end": 231, + "ctxt": 0 + }, + "argument": { + "type": "StringLiteral", + "span": { + "start": 229, + "end": 231, + "ctxt": 0 + }, + "value": "", + "raw": "''" + } + } + ] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": null + }, + "kind": "getter", + "isStatic": false, + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false + }, + { + "type": "ClassMethod", + "span": { + "start": 238, + "end": 259, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 242, + "end": 253, + "ctxt": 0 + }, + "value": "textContent", + "optional": false + }, + "function": { + "params": [ + { + "type": "Parameter", + "span": { + "start": 254, + "end": 255, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 254, + "end": 255, + "ctxt": 0 + }, + "value": "x", + "optional": false, + "typeAnnotation": null + } + } + ], + "decorators": [], + "span": { + "start": 238, + "end": 259, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 257, + "end": 259, + "ctxt": 0 + }, + "stmts": [] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": null + }, + "kind": "setter", + "isStatic": false, + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false + }, + { + "type": "ClassMethod", + "span": { + "start": 262, + "end": 288, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 262, + "end": 271, + "ctxt": 0 + }, + "value": "cloneNode", + "optional": false + }, + "function": { + "params": [], + "decorators": [], + "span": { + "start": 262, + "end": 288, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 274, + "end": 288, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ReturnStatement", + "span": { + "start": 276, + "end": 287, + "ctxt": 0 + }, + "argument": { + "type": "ThisExpression", + "span": { + "start": 283, + "end": 287, + "ctxt": 0 + } + } + } + ] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": null + }, + "kind": "method", + "isStatic": false, + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false + } + ], + "superClass": null, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + } + }, + { + "type": "ExportDeclaration", + "span": { + "start": 291, + "end": 334, + "ctxt": 0 + }, + "declaration": { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 304, + "end": 315, + "ctxt": 0 + }, + "value": "HTMLElement", + "optional": false + }, + "declare": false, + "span": { + "start": 298, + "end": 334, + "ctxt": 0 + }, + "decorators": [], + "body": [], + "superClass": { + "type": "Identifier", + "span": { + "start": 324, + "end": 331, + "ctxt": 0 + }, + "value": "Element", + "optional": false + }, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + } + }, + { + "type": "ExportDeclaration", + "span": { + "start": 335, + "end": 500, + "ctxt": 0 + }, + "declaration": { + "type": "ClassDeclaration", + "identifier": { + "type": "Identifier", + "span": { + "start": 348, + "end": 359, + "ctxt": 0 + }, + "value": "TextElement", + "optional": false + }, + "declare": false, + "span": { + "start": 342, + "end": 500, + "ctxt": 0 + }, + "decorators": [], + "body": [ + { + "type": "ClassMethod", + "span": { + "start": 384, + "end": 428, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 388, + "end": 397, + "ctxt": 0 + }, + "value": "innerHTML", + "optional": false + }, + "function": { + "params": [], + "decorators": [], + "span": { + "start": 384, + "end": 428, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 400, + "end": 428, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ReturnStatement", + "span": { + "start": 402, + "end": 426, + "ctxt": 0 + }, + "argument": { + "type": "MemberExpression", + "span": { + "start": 409, + "end": 425, + "ctxt": 0 + }, + "object": { + "type": "ThisExpression", + "span": { + "start": 409, + "end": 413, + "ctxt": 0 + } + }, + "property": { + "type": "Identifier", + "span": { + "start": 414, + "end": 425, + "ctxt": 0 + }, + "value": "textContent", + "optional": false + } + } + } + ] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": null + }, + "kind": "getter", + "isStatic": false, + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false + }, + { + "type": "ClassMethod", + "span": { + "start": 431, + "end": 479, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 435, + "end": 444, + "ctxt": 0 + }, + "value": "innerHTML", + "optional": false + }, + "function": { + "params": [ + { + "type": "Parameter", + "span": { + "start": 445, + "end": 449, + "ctxt": 0 + }, + "decorators": [], + "pat": { + "type": "Identifier", + "span": { + "start": 445, + "end": 449, + "ctxt": 0 + }, + "value": "html", + "optional": false, + "typeAnnotation": null + } + } + ], + "decorators": [], + "span": { + "start": 431, + "end": 479, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 451, + "end": 479, + "ctxt": 0 + }, + "stmts": [ + { + "type": "ExpressionStatement", + "span": { + "start": 453, + "end": 477, + "ctxt": 0 + }, + "expression": { + "type": "AssignmentExpression", + "span": { + "start": 453, + "end": 476, + "ctxt": 0 + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "span": { + "start": 453, + "end": 469, + "ctxt": 0 + }, + "object": { + "type": "ThisExpression", + "span": { + "start": 453, + "end": 457, + "ctxt": 0 + } + }, + "property": { + "type": "Identifier", + "span": { + "start": 458, + "end": 469, + "ctxt": 0 + }, + "value": "textContent", + "optional": false + } + }, + "right": { + "type": "Identifier", + "span": { + "start": 472, + "end": 476, + "ctxt": 0 + }, + "value": "html", + "optional": false + } + } + } + ] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": null + }, + "kind": "setter", + "isStatic": false, + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false + }, + { + "type": "ClassMethod", + "span": { + "start": 482, + "end": 498, + "ctxt": 0 + }, + "key": { + "type": "Identifier", + "span": { + "start": 482, + "end": 490, + "ctxt": 0 + }, + "value": "toString", + "optional": false + }, + "function": { + "params": [], + "decorators": [], + "span": { + "start": 482, + "end": 498, + "ctxt": 0 + }, + "body": { + "type": "BlockStatement", + "span": { + "start": 493, + "end": 498, + "ctxt": 0 + }, + "stmts": [] + }, + "generator": false, + "async": false, + "typeParameters": null, + "returnType": null + }, + "kind": "method", + "isStatic": false, + "accessibility": null, + "isAbstract": false, + "isOptional": false, + "isOverride": false + } + ], + "superClass": { + "type": "Identifier", + "span": { + "start": 368, + "end": 379, + "ctxt": 0 + }, + "value": "HTMLElement", + "optional": false + }, + "isAbstract": false, + "typeParams": null, + "superTypeParams": null, + "implements": [] + } + } + ], + "interpreter": null +} diff --git a/crates/swc_ecma_parser/tests/tsc/thisPropertyAssignmentInherited.ts b/crates/swc_ecma_parser/tests/tsc/thisPropertyAssignmentInherited.ts new file mode 100644 index 000000000000..bd77274270bb --- /dev/null +++ b/crates/swc_ecma_parser/tests/tsc/thisPropertyAssignmentInherited.ts @@ -0,0 +1,23 @@ +// @checkJs: true +// @strict: true +// @emitDeclarationOnly: true +// @declaration: true +// @Filename: thisPropertyAssignmentInherited.js +export class Element { + /** + * @returns {String} + */ + get textContent() { + return '' + } + set textContent(x) {} + cloneNode() { return this} +} +export class HTMLElement extends Element {} +export class TextElement extends HTMLElement { + get innerHTML() { return this.textContent; } + set innerHTML(html) { this.textContent = html; } + toString() { + } +} + diff --git a/crates/swc_ecma_parser/tests/tsc/unknownControlFlow.json b/crates/swc_ecma_parser/tests/tsc/unknownControlFlow.json index 09997ef6926c..8845926db985 100644 --- a/crates/swc_ecma_parser/tests/tsc/unknownControlFlow.json +++ b/crates/swc_ecma_parser/tests/tsc/unknownControlFlow.json @@ -2,7 +2,7 @@ "type": "Script", "span": { "start": 41, - "end": 9005, + "end": 9010, "ctxt": 0 }, "body": [ @@ -57,16 +57,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 76, - "end": 96, + "start": 81, + "end": 101, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 81, - "end": 84, + "start": 86, + "end": 89, "ctxt": 0 }, "value": "T02", @@ -76,16 +76,16 @@ "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 87, - "end": 95, + "start": 92, + "end": 100, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 87, - "end": 89, + "start": 92, + "end": 94, "ctxt": 0 }, "members": [] @@ -93,15 +93,15 @@ { "type": "TsLiteralType", "span": { - "start": 92, - "end": 95, + "start": 97, + "end": 100, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 92, - "end": 95, + "start": 97, + "end": 100, "ctxt": 0 }, "value": "a", @@ -114,16 +114,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 105, - "end": 128, + "start": 110, + "end": 133, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 110, - "end": 113, + "start": 115, + "end": 118, "ctxt": 0 }, "value": "T03", @@ -133,16 +133,16 @@ "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 116, - "end": 127, + "start": 121, + "end": 132, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 116, - "end": 118, + "start": 121, + "end": 123, "ctxt": 0 }, "members": [] @@ -150,8 +150,8 @@ { "type": "TsKeywordType", "span": { - "start": 121, - "end": 127, + "start": 126, + "end": 132, "ctxt": 0 }, "kind": "object" @@ -162,16 +162,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 140, - "end": 170, + "start": 145, + "end": 175, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 145, - "end": 148, + "start": 150, + "end": 153, "ctxt": 0 }, "value": "T04", @@ -181,16 +181,16 @@ "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 151, - "end": 169, + "start": 156, + "end": 174, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 151, - "end": 153, + "start": 156, + "end": 158, "ctxt": 0 }, "members": [] @@ -198,24 +198,24 @@ { "type": "TsTypeLiteral", "span": { - "start": 156, - "end": 169, + "start": 161, + "end": 174, "ctxt": 0 }, "members": [ { "type": "TsPropertySignature", "span": { - "start": 158, - "end": 167, + "start": 163, + "end": 172, "ctxt": 0 }, "readonly": false, "key": { "type": "Identifier", "span": { - "start": 158, - "end": 159, + "start": 163, + "end": 164, "ctxt": 0 }, "value": "x", @@ -228,15 +228,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 159, - "end": 167, + "start": 164, + "end": 172, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 161, - "end": 167, + "start": 166, + "end": 172, "ctxt": 0 }, "kind": "number" @@ -252,16 +252,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 189, - "end": 210, + "start": 194, + "end": 215, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 194, - "end": 197, + "start": 199, + "end": 202, "ctxt": 0 }, "value": "T05", @@ -271,16 +271,16 @@ "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 200, - "end": 209, + "start": 205, + "end": 214, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 200, - "end": 202, + "start": 205, + "end": 207, "ctxt": 0 }, "members": [] @@ -288,8 +288,8 @@ { "type": "TsKeywordType", "span": { - "start": 205, - "end": 209, + "start": 210, + "end": 214, "ctxt": 0 }, "kind": "null" @@ -300,16 +300,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 221, - "end": 247, + "start": 226, + "end": 252, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 226, - "end": 229, + "start": 231, + "end": 234, "ctxt": 0 }, "value": "T06", @@ -319,16 +319,16 @@ "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 232, - "end": 246, + "start": 237, + "end": 251, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 232, - "end": 234, + "start": 237, + "end": 239, "ctxt": 0 }, "members": [] @@ -336,8 +336,8 @@ { "type": "TsKeywordType", "span": { - "start": 237, - "end": 246, + "start": 242, + "end": 251, "ctxt": 0 }, "kind": "undefined" @@ -348,16 +348,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 258, - "end": 286, + "start": 263, + "end": 291, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 263, - "end": 266, + "start": 268, + "end": 271, "ctxt": 0 }, "value": "T07", @@ -367,16 +367,16 @@ "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 269, - "end": 285, + "start": 274, + "end": 290, "ctxt": 0 }, "types": [ { "type": "TsKeywordType", "span": { - "start": 269, - "end": 278, + "start": 274, + "end": 283, "ctxt": 0 }, "kind": "undefined" @@ -384,8 +384,8 @@ { "type": "TsKeywordType", "span": { - "start": 281, - "end": 285, + "start": 286, + "end": 290, "ctxt": 0 }, "kind": "void" @@ -396,16 +396,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 302, - "end": 325, + "start": 307, + "end": 330, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 307, - "end": 310, + "start": 312, + "end": 315, "ctxt": 0 }, "value": "T10", @@ -415,16 +415,16 @@ "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 313, - "end": 324, + "start": 318, + "end": 329, "ctxt": 0 }, "types": [ { "type": "TsKeywordType", "span": { - "start": 313, - "end": 319, + "start": 318, + "end": 324, "ctxt": 0 }, "kind": "string" @@ -432,8 +432,8 @@ { "type": "TsTypeLiteral", "span": { - "start": 322, - "end": 324, + "start": 327, + "end": 329, "ctxt": 0 }, "members": [] @@ -444,16 +444,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 350, - "end": 373, + "start": 355, + "end": 378, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 355, - "end": 358, + "start": 360, + "end": 363, "ctxt": 0 }, "value": "T11", @@ -463,16 +463,16 @@ "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 361, - "end": 372, + "start": 366, + "end": 377, "ctxt": 0 }, "types": [ { "type": "TsKeywordType", "span": { - "start": 361, - "end": 367, + "start": 366, + "end": 372, "ctxt": 0 }, "kind": "number" @@ -480,8 +480,8 @@ { "type": "TsTypeLiteral", "span": { - "start": 370, - "end": 372, + "start": 375, + "end": 377, "ctxt": 0 }, "members": [] @@ -492,16 +492,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 398, - "end": 421, + "start": 403, + "end": 426, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 403, - "end": 406, + "start": 408, + "end": 411, "ctxt": 0 }, "value": "T12", @@ -511,16 +511,16 @@ "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 409, - "end": 420, + "start": 414, + "end": 425, "ctxt": 0 }, "types": [ { "type": "TsKeywordType", "span": { - "start": 409, - "end": 415, + "start": 414, + "end": 420, "ctxt": 0 }, "kind": "bigint" @@ -528,8 +528,8 @@ { "type": "TsTypeLiteral", "span": { - "start": 418, - "end": 420, + "start": 423, + "end": 425, "ctxt": 0 }, "members": [] @@ -540,16 +540,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 447, - "end": 466, + "start": 452, + "end": 471, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 452, - "end": 460, + "start": 457, + "end": 465, "ctxt": 0 }, "value": "ThisNode", @@ -559,8 +559,8 @@ "typeAnnotation": { "type": "TsTypeLiteral", "span": { - "start": 463, - "end": 465, + "start": 468, + "end": 470, "ctxt": 0 }, "members": [] @@ -569,16 +569,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 467, - "end": 486, + "start": 472, + "end": 491, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 472, - "end": 480, + "start": 477, + "end": 485, "ctxt": 0 }, "value": "ThatNode", @@ -588,8 +588,8 @@ "typeAnnotation": { "type": "TsTypeLiteral", "span": { - "start": 483, - "end": 485, + "start": 488, + "end": 490, "ctxt": 0 }, "members": [] @@ -598,16 +598,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 487, - "end": 529, + "start": 492, + "end": 534, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 492, - "end": 506, + "start": 497, + "end": 511, "ctxt": 0 }, "value": "ThisOrThatNode", @@ -617,23 +617,23 @@ "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 509, - "end": 528, + "start": 514, + "end": 533, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 509, - "end": 517, + "start": 514, + "end": 522, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 509, - "end": 517, + "start": 514, + "end": 522, "ctxt": 0 }, "value": "ThisNode", @@ -644,15 +644,15 @@ { "type": "TsTypeReference", "span": { - "start": 520, - "end": 528, + "start": 525, + "end": 533, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 520, - "end": 528, + "start": 525, + "end": 533, "ctxt": 0 }, "value": "ThatNode", @@ -668,8 +668,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 540, - "end": 543, + "start": 545, + "end": 548, "ctxt": 0 }, "value": "f01", @@ -680,16 +680,16 @@ { "type": "Parameter", "span": { - "start": 544, - "end": 554, + "start": 549, + "end": 559, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 544, - "end": 554, + "start": 549, + "end": 559, "ctxt": 0 }, "value": "u", @@ -697,15 +697,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 545, - "end": 554, + "start": 550, + "end": 559, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 547, - "end": 554, + "start": 552, + "end": 559, "ctxt": 0 }, "kind": "unknown" @@ -716,23 +716,23 @@ ], "decorators": [], "span": { - "start": 531, - "end": 734, + "start": 536, + "end": 739, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 556, - "end": 734, + "start": 561, + "end": 739, "ctxt": 0 }, "stmts": [ { "type": "VariableDeclaration", "span": { - "start": 562, - "end": 577, + "start": 567, + "end": 582, "ctxt": 0 }, "kind": "let", @@ -741,15 +741,15 @@ { "type": "VariableDeclarator", "span": { - "start": 566, - "end": 576, + "start": 571, + "end": 581, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 566, - "end": 568, + "start": 571, + "end": 573, "ctxt": 0 }, "value": "x1", @@ -757,15 +757,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 568, - "end": 572, + "start": 573, + "end": 577, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeLiteral", "span": { - "start": 570, - "end": 572, + "start": 575, + "end": 577, "ctxt": 0 }, "members": [] @@ -775,8 +775,8 @@ "init": { "type": "Identifier", "span": { - "start": 575, - "end": 576, + "start": 580, + "end": 581, "ctxt": 0 }, "value": "u", @@ -789,8 +789,8 @@ { "type": "VariableDeclaration", "span": { - "start": 592, - "end": 626, + "start": 597, + "end": 631, "ctxt": 0 }, "kind": "let", @@ -799,15 +799,15 @@ { "type": "VariableDeclarator", "span": { - "start": 596, - "end": 625, + "start": 601, + "end": 630, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 596, - "end": 598, + "start": 601, + "end": 603, "ctxt": 0 }, "value": "x2", @@ -815,23 +815,23 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 598, - "end": 621, + "start": 603, + "end": 626, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 600, - "end": 621, + "start": 605, + "end": 626, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 600, - "end": 602, + "start": 605, + "end": 607, "ctxt": 0 }, "members": [] @@ -839,8 +839,8 @@ { "type": "TsKeywordType", "span": { - "start": 605, - "end": 609, + "start": 610, + "end": 614, "ctxt": 0 }, "kind": "null" @@ -848,8 +848,8 @@ { "type": "TsKeywordType", "span": { - "start": 612, - "end": 621, + "start": 617, + "end": 626, "ctxt": 0 }, "kind": "undefined" @@ -861,8 +861,8 @@ "init": { "type": "Identifier", "span": { - "start": 624, - "end": 625, + "start": 629, + "end": 630, "ctxt": 0 }, "value": "u", @@ -875,8 +875,8 @@ { "type": "VariableDeclaration", "span": { - "start": 631, - "end": 681, + "start": 636, + "end": 686, "ctxt": 0 }, "kind": "let", @@ -885,15 +885,15 @@ { "type": "VariableDeclarator", "span": { - "start": 635, - "end": 680, + "start": 640, + "end": 685, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 635, - "end": 637, + "start": 640, + "end": 642, "ctxt": 0 }, "value": "x3", @@ -901,23 +901,23 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 637, - "end": 676, + "start": 642, + "end": 681, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 639, - "end": 676, + "start": 644, + "end": 681, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 639, - "end": 641, + "start": 644, + "end": 646, "ctxt": 0 }, "members": [] @@ -925,24 +925,24 @@ { "type": "TsTypeLiteral", "span": { - "start": 644, - "end": 657, + "start": 649, + "end": 662, "ctxt": 0 }, "members": [ { "type": "TsPropertySignature", "span": { - "start": 646, - "end": 655, + "start": 651, + "end": 660, "ctxt": 0 }, "readonly": false, "key": { "type": "Identifier", "span": { - "start": 646, - "end": 647, + "start": 651, + "end": 652, "ctxt": 0 }, "value": "x", @@ -955,15 +955,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 647, - "end": 655, + "start": 652, + "end": 660, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 649, - "end": 655, + "start": 654, + "end": 660, "ctxt": 0 }, "kind": "string" @@ -976,8 +976,8 @@ { "type": "TsKeywordType", "span": { - "start": 660, - "end": 664, + "start": 665, + "end": 669, "ctxt": 0 }, "kind": "null" @@ -985,8 +985,8 @@ { "type": "TsKeywordType", "span": { - "start": 667, - "end": 676, + "start": 672, + "end": 681, "ctxt": 0 }, "kind": "undefined" @@ -998,8 +998,8 @@ "init": { "type": "Identifier", "span": { - "start": 679, - "end": 680, + "start": 684, + "end": 685, "ctxt": 0 }, "value": "u", @@ -1012,8 +1012,8 @@ { "type": "VariableDeclaration", "span": { - "start": 686, - "end": 732, + "start": 691, + "end": 737, "ctxt": 0 }, "kind": "let", @@ -1022,15 +1022,15 @@ { "type": "VariableDeclarator", "span": { - "start": 690, - "end": 731, + "start": 695, + "end": 736, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 690, - "end": 692, + "start": 695, + "end": 697, "ctxt": 0 }, "value": "x4", @@ -1038,30 +1038,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 692, - "end": 727, + "start": 697, + "end": 732, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 694, - "end": 727, + "start": 699, + "end": 732, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 694, - "end": 708, + "start": 699, + "end": 713, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 694, - "end": 708, + "start": 699, + "end": 713, "ctxt": 0 }, "value": "ThisOrThatNode", @@ -1072,8 +1072,8 @@ { "type": "TsKeywordType", "span": { - "start": 711, - "end": 715, + "start": 716, + "end": 720, "ctxt": 0 }, "kind": "null" @@ -1081,8 +1081,8 @@ { "type": "TsKeywordType", "span": { - "start": 718, - "end": 727, + "start": 723, + "end": 732, "ctxt": 0 }, "kind": "undefined" @@ -1094,8 +1094,8 @@ "init": { "type": "Identifier", "span": { - "start": 730, - "end": 731, + "start": 735, + "end": 736, "ctxt": 0 }, "value": "u", @@ -1117,8 +1117,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 745, - "end": 748, + "start": 750, + "end": 753, "ctxt": 0 }, "value": "f10", @@ -1129,16 +1129,16 @@ { "type": "Parameter", "span": { - "start": 749, - "end": 759, + "start": 754, + "end": 764, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 749, - "end": 759, + "start": 754, + "end": 764, "ctxt": 0 }, "value": "x", @@ -1146,15 +1146,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 750, - "end": 759, + "start": 755, + "end": 764, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 752, - "end": 759, + "start": 757, + "end": 764, "ctxt": 0 }, "kind": "unknown" @@ -1165,30 +1165,30 @@ ], "decorators": [], "span": { - "start": 736, - "end": 919, + "start": 741, + "end": 924, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 761, - "end": 919, + "start": 766, + "end": 924, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 767, - "end": 839, + "start": 772, + "end": 844, "ctxt": 0 }, "test": { "type": "Identifier", "span": { - "start": 771, - "end": 772, + "start": 776, + "end": 777, "ctxt": 0 }, "value": "x", @@ -1197,23 +1197,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 774, - "end": 799, + "start": 779, + "end": 804, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 784, - "end": 786, + "start": 789, + "end": 791, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 784, - "end": 785, + "start": 789, + "end": 790, "ctxt": 0 }, "value": "x", @@ -1225,23 +1225,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 809, - "end": 839, + "start": 814, + "end": 844, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 819, - "end": 821, + "start": 824, + "end": 826, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 819, - "end": 820, + "start": 824, + "end": 825, "ctxt": 0 }, "value": "x", @@ -1254,23 +1254,23 @@ { "type": "IfStatement", "span": { - "start": 844, - "end": 917, + "start": 849, + "end": 922, "ctxt": 0 }, "test": { "type": "UnaryExpression", "span": { - "start": 848, - "end": 850, + "start": 853, + "end": 855, "ctxt": 0 }, "operator": "!", "argument": { "type": "Identifier", "span": { - "start": 849, - "end": 850, + "start": 854, + "end": 855, "ctxt": 0 }, "value": "x", @@ -1280,23 +1280,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 852, - "end": 882, + "start": 857, + "end": 887, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 862, - "end": 864, + "start": 867, + "end": 869, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 862, - "end": 863, + "start": 867, + "end": 868, "ctxt": 0 }, "value": "x", @@ -1308,23 +1308,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 892, - "end": 917, + "start": 897, + "end": 922, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 902, - "end": 904, + "start": 907, + "end": 909, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 902, - "end": 903, + "start": 907, + "end": 908, "ctxt": 0 }, "value": "x", @@ -1346,8 +1346,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 930, - "end": 933, + "start": 935, + "end": 938, "ctxt": 0 }, "value": "f11", @@ -1358,16 +1358,16 @@ { "type": "Parameter", "span": { - "start": 937, - "end": 941, + "start": 942, + "end": 946, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 937, - "end": 941, + "start": 942, + "end": 946, "ctxt": 0 }, "value": "x", @@ -1375,22 +1375,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 938, - "end": 941, + "start": 943, + "end": 946, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 940, - "end": 941, + "start": 945, + "end": 946, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 940, - "end": 941, + "start": 945, + "end": 946, "ctxt": 0 }, "value": "T", @@ -1404,30 +1404,30 @@ ], "decorators": [], "span": { - "start": 921, - "end": 1097, + "start": 926, + "end": 1102, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 943, - "end": 1097, + "start": 948, + "end": 1102, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 949, - "end": 1019, + "start": 954, + "end": 1024, "ctxt": 0 }, "test": { "type": "Identifier", "span": { - "start": 953, - "end": 954, + "start": 958, + "end": 959, "ctxt": 0 }, "value": "x", @@ -1436,23 +1436,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 956, - "end": 985, + "start": 961, + "end": 990, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 966, - "end": 968, + "start": 971, + "end": 973, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 966, - "end": 967, + "start": 971, + "end": 972, "ctxt": 0 }, "value": "x", @@ -1464,23 +1464,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 995, - "end": 1019, + "start": 1000, + "end": 1024, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1005, - "end": 1007, + "start": 1010, + "end": 1012, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1005, - "end": 1006, + "start": 1010, + "end": 1011, "ctxt": 0 }, "value": "x", @@ -1493,23 +1493,23 @@ { "type": "IfStatement", "span": { - "start": 1024, - "end": 1095, + "start": 1029, + "end": 1100, "ctxt": 0 }, "test": { "type": "UnaryExpression", "span": { - "start": 1028, - "end": 1030, + "start": 1033, + "end": 1035, "ctxt": 0 }, "operator": "!", "argument": { "type": "Identifier", "span": { - "start": 1029, - "end": 1030, + "start": 1034, + "end": 1035, "ctxt": 0 }, "value": "x", @@ -1519,23 +1519,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 1032, - "end": 1056, + "start": 1037, + "end": 1061, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1042, - "end": 1044, + "start": 1047, + "end": 1049, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1042, - "end": 1043, + "start": 1047, + "end": 1048, "ctxt": 0 }, "value": "x", @@ -1547,23 +1547,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 1066, - "end": 1095, + "start": 1071, + "end": 1100, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1076, - "end": 1078, + "start": 1081, + "end": 1083, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1076, - "end": 1077, + "start": 1081, + "end": 1082, "ctxt": 0 }, "value": "x", @@ -1580,23 +1580,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 933, - "end": 936, + "start": 938, + "end": 941, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 934, - "end": 935, + "start": 939, + "end": 940, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 934, - "end": 935, + "start": 939, + "end": 940, "ctxt": 0 }, "value": "T", @@ -1617,8 +1617,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 1108, - "end": 1111, + "start": 1113, + "end": 1116, "ctxt": 0 }, "value": "f12", @@ -1629,16 +1629,16 @@ { "type": "Parameter", "span": { - "start": 1126, - "end": 1130, + "start": 1131, + "end": 1135, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 1126, - "end": 1130, + "start": 1131, + "end": 1135, "ctxt": 0 }, "value": "x", @@ -1646,22 +1646,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 1127, - "end": 1130, + "start": 1132, + "end": 1135, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 1129, - "end": 1130, + "start": 1134, + "end": 1135, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 1129, - "end": 1130, + "start": 1134, + "end": 1135, "ctxt": 0 }, "value": "T", @@ -1675,30 +1675,30 @@ ], "decorators": [], "span": { - "start": 1099, - "end": 1205, + "start": 1104, + "end": 1210, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 1132, - "end": 1205, + "start": 1137, + "end": 1210, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 1138, - "end": 1203, + "start": 1143, + "end": 1208, "ctxt": 0 }, "test": { "type": "Identifier", "span": { - "start": 1142, - "end": 1143, + "start": 1147, + "end": 1148, "ctxt": 0 }, "value": "x", @@ -1707,23 +1707,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 1145, - "end": 1169, + "start": 1150, + "end": 1174, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1155, - "end": 1157, + "start": 1160, + "end": 1162, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1155, - "end": 1156, + "start": 1160, + "end": 1161, "ctxt": 0 }, "value": "x", @@ -1735,23 +1735,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 1179, - "end": 1203, + "start": 1184, + "end": 1208, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1189, - "end": 1191, + "start": 1194, + "end": 1196, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1189, - "end": 1190, + "start": 1194, + "end": 1195, "ctxt": 0 }, "value": "x", @@ -1768,23 +1768,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 1111, - "end": 1125, + "start": 1116, + "end": 1130, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 1112, - "end": 1124, + "start": 1117, + "end": 1129, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 1112, - "end": 1113, + "start": 1117, + "end": 1118, "ctxt": 0 }, "value": "T", @@ -1796,8 +1796,8 @@ "constraint": { "type": "TsTypeLiteral", "span": { - "start": 1122, - "end": 1124, + "start": 1127, + "end": 1129, "ctxt": 0 }, "members": [] @@ -1813,8 +1813,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 1216, - "end": 1219, + "start": 1221, + "end": 1224, "ctxt": 0 }, "value": "f20", @@ -1825,16 +1825,16 @@ { "type": "Parameter", "span": { - "start": 1220, - "end": 1230, + "start": 1225, + "end": 1235, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 1220, - "end": 1230, + "start": 1225, + "end": 1235, "ctxt": 0 }, "value": "x", @@ -1842,15 +1842,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 1221, - "end": 1230, + "start": 1226, + "end": 1235, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 1223, - "end": 1230, + "start": 1228, + "end": 1235, "ctxt": 0 }, "kind": "unknown" @@ -1861,38 +1861,38 @@ ], "decorators": [], "span": { - "start": 1207, - "end": 1737, + "start": 1212, + "end": 1742, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 1232, - "end": 1737, + "start": 1237, + "end": 1742, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 1238, - "end": 1333, + "start": 1243, + "end": 1338, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 1242, - "end": 1257, + "start": 1247, + "end": 1262, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 1242, - "end": 1243, + "start": 1247, + "end": 1248, "ctxt": 0 }, "value": "x", @@ -1901,8 +1901,8 @@ "right": { "type": "Identifier", "span": { - "start": 1248, - "end": 1257, + "start": 1253, + "end": 1262, "ctxt": 0 }, "value": "undefined", @@ -1912,23 +1912,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 1259, - "end": 1291, + "start": 1264, + "end": 1296, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1269, - "end": 1271, + "start": 1274, + "end": 1276, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1269, - "end": 1270, + "start": 1274, + "end": 1275, "ctxt": 0 }, "value": "x", @@ -1940,23 +1940,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 1301, - "end": 1333, + "start": 1306, + "end": 1338, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1311, - "end": 1313, + "start": 1316, + "end": 1318, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1311, - "end": 1312, + "start": 1316, + "end": 1317, "ctxt": 0 }, "value": "x", @@ -1969,23 +1969,23 @@ { "type": "IfStatement", "span": { - "start": 1338, - "end": 1428, + "start": 1343, + "end": 1433, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 1342, - "end": 1352, + "start": 1347, + "end": 1357, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 1342, - "end": 1343, + "start": 1347, + "end": 1348, "ctxt": 0 }, "value": "x", @@ -1994,8 +1994,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 1348, - "end": 1352, + "start": 1353, + "end": 1357, "ctxt": 0 } } @@ -2003,23 +2003,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 1354, - "end": 1391, + "start": 1359, + "end": 1396, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1364, - "end": 1366, + "start": 1369, + "end": 1371, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1364, - "end": 1365, + "start": 1369, + "end": 1370, "ctxt": 0 }, "value": "x", @@ -2031,23 +2031,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 1401, - "end": 1428, + "start": 1406, + "end": 1433, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1411, - "end": 1413, + "start": 1416, + "end": 1418, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1411, - "end": 1412, + "start": 1416, + "end": 1417, "ctxt": 0 }, "value": "x", @@ -2060,31 +2060,31 @@ { "type": "IfStatement", "span": { - "start": 1433, - "end": 1542, + "start": 1438, + "end": 1547, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 1437, - "end": 1466, + "start": 1442, + "end": 1471, "ctxt": 0 }, "operator": "&&", "left": { "type": "BinaryExpression", "span": { - "start": 1437, - "end": 1452, + "start": 1442, + "end": 1457, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 1437, - "end": 1438, + "start": 1442, + "end": 1443, "ctxt": 0 }, "value": "x", @@ -2093,8 +2093,8 @@ "right": { "type": "Identifier", "span": { - "start": 1443, - "end": 1452, + "start": 1448, + "end": 1457, "ctxt": 0 }, "value": "undefined", @@ -2104,16 +2104,16 @@ "right": { "type": "BinaryExpression", "span": { - "start": 1456, - "end": 1466, + "start": 1461, + "end": 1471, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 1456, - "end": 1457, + "start": 1461, + "end": 1462, "ctxt": 0 }, "value": "x", @@ -2122,8 +2122,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 1462, - "end": 1466, + "start": 1467, + "end": 1471, "ctxt": 0 } } @@ -2132,23 +2132,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 1468, - "end": 1493, + "start": 1473, + "end": 1498, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1478, - "end": 1480, + "start": 1483, + "end": 1485, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1478, - "end": 1479, + "start": 1483, + "end": 1484, "ctxt": 0 }, "value": "x", @@ -2160,23 +2160,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 1503, - "end": 1542, + "start": 1508, + "end": 1547, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1513, - "end": 1515, + "start": 1518, + "end": 1520, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1513, - "end": 1514, + "start": 1518, + "end": 1519, "ctxt": 0 }, "value": "x", @@ -2189,23 +2189,23 @@ { "type": "IfStatement", "span": { - "start": 1547, - "end": 1641, + "start": 1552, + "end": 1646, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 1551, - "end": 1565, + "start": 1556, + "end": 1570, "ctxt": 0 }, "operator": "!=", "left": { "type": "Identifier", "span": { - "start": 1551, - "end": 1552, + "start": 1556, + "end": 1557, "ctxt": 0 }, "value": "x", @@ -2214,8 +2214,8 @@ "right": { "type": "Identifier", "span": { - "start": 1556, - "end": 1565, + "start": 1561, + "end": 1570, "ctxt": 0 }, "value": "undefined", @@ -2225,23 +2225,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 1567, - "end": 1592, + "start": 1572, + "end": 1597, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1577, - "end": 1579, + "start": 1582, + "end": 1584, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1577, - "end": 1578, + "start": 1582, + "end": 1583, "ctxt": 0 }, "value": "x", @@ -2253,23 +2253,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 1602, - "end": 1641, + "start": 1607, + "end": 1646, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1612, - "end": 1614, + "start": 1617, + "end": 1619, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1612, - "end": 1613, + "start": 1617, + "end": 1618, "ctxt": 0 }, "value": "x", @@ -2282,23 +2282,23 @@ { "type": "IfStatement", "span": { - "start": 1646, - "end": 1735, + "start": 1651, + "end": 1740, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 1650, - "end": 1659, + "start": 1655, + "end": 1664, "ctxt": 0 }, "operator": "!=", "left": { "type": "Identifier", "span": { - "start": 1650, - "end": 1651, + "start": 1655, + "end": 1656, "ctxt": 0 }, "value": "x", @@ -2307,8 +2307,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 1655, - "end": 1659, + "start": 1660, + "end": 1664, "ctxt": 0 } } @@ -2316,23 +2316,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 1661, - "end": 1686, + "start": 1666, + "end": 1691, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1671, - "end": 1673, + "start": 1676, + "end": 1678, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1671, - "end": 1672, + "start": 1676, + "end": 1677, "ctxt": 0 }, "value": "x", @@ -2344,23 +2344,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 1696, - "end": 1735, + "start": 1701, + "end": 1740, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1706, - "end": 1708, + "start": 1711, + "end": 1713, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1706, - "end": 1707, + "start": 1711, + "end": 1712, "ctxt": 0 }, "value": "x", @@ -2382,8 +2382,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 1748, - "end": 1751, + "start": 1753, + "end": 1756, "ctxt": 0 }, "value": "f21", @@ -2394,16 +2394,16 @@ { "type": "Parameter", "span": { - "start": 1755, - "end": 1759, + "start": 1760, + "end": 1764, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 1755, - "end": 1759, + "start": 1760, + "end": 1764, "ctxt": 0 }, "value": "x", @@ -2411,22 +2411,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 1756, - "end": 1759, + "start": 1761, + "end": 1764, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 1758, - "end": 1759, + "start": 1763, + "end": 1764, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 1758, - "end": 1759, + "start": 1763, + "end": 1764, "ctxt": 0 }, "value": "T", @@ -2440,38 +2440,38 @@ ], "decorators": [], "span": { - "start": 1739, - "end": 2234, + "start": 1744, + "end": 2239, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 1761, - "end": 2234, + "start": 1766, + "end": 2239, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 1767, - "end": 1860, + "start": 1772, + "end": 1865, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 1771, - "end": 1786, + "start": 1776, + "end": 1791, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 1771, - "end": 1772, + "start": 1776, + "end": 1777, "ctxt": 0 }, "value": "x", @@ -2480,8 +2480,8 @@ "right": { "type": "Identifier", "span": { - "start": 1777, - "end": 1786, + "start": 1782, + "end": 1791, "ctxt": 0 }, "value": "undefined", @@ -2491,23 +2491,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 1788, - "end": 1826, + "start": 1793, + "end": 1831, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1798, - "end": 1800, + "start": 1803, + "end": 1805, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1798, - "end": 1799, + "start": 1803, + "end": 1804, "ctxt": 0 }, "value": "x", @@ -2519,23 +2519,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 1836, - "end": 1860, + "start": 1841, + "end": 1865, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1846, - "end": 1848, + "start": 1851, + "end": 1853, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1846, - "end": 1847, + "start": 1851, + "end": 1852, "ctxt": 0 }, "value": "x", @@ -2548,23 +2548,23 @@ { "type": "IfStatement", "span": { - "start": 1865, - "end": 1958, + "start": 1870, + "end": 1963, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 1869, - "end": 1879, + "start": 1874, + "end": 1884, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 1869, - "end": 1870, + "start": 1874, + "end": 1875, "ctxt": 0 }, "value": "x", @@ -2573,8 +2573,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 1875, - "end": 1879, + "start": 1880, + "end": 1884, "ctxt": 0 } } @@ -2582,23 +2582,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 1881, - "end": 1924, + "start": 1886, + "end": 1929, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1891, - "end": 1893, + "start": 1896, + "end": 1898, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1891, - "end": 1892, + "start": 1896, + "end": 1897, "ctxt": 0 }, "value": "x", @@ -2610,23 +2610,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 1934, - "end": 1958, + "start": 1939, + "end": 1963, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 1944, - "end": 1946, + "start": 1949, + "end": 1951, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 1944, - "end": 1945, + "start": 1949, + "end": 1950, "ctxt": 0 }, "value": "x", @@ -2639,31 +2639,31 @@ { "type": "IfStatement", "span": { - "start": 1963, - "end": 2061, + "start": 1968, + "end": 2066, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 1967, - "end": 1996, + "start": 1972, + "end": 2001, "ctxt": 0 }, "operator": "&&", "left": { "type": "BinaryExpression", "span": { - "start": 1967, - "end": 1982, + "start": 1972, + "end": 1987, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 1967, - "end": 1968, + "start": 1972, + "end": 1973, "ctxt": 0 }, "value": "x", @@ -2672,8 +2672,8 @@ "right": { "type": "Identifier", "span": { - "start": 1973, - "end": 1982, + "start": 1978, + "end": 1987, "ctxt": 0 }, "value": "undefined", @@ -2683,16 +2683,16 @@ "right": { "type": "BinaryExpression", "span": { - "start": 1986, - "end": 1996, + "start": 1991, + "end": 2001, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 1986, - "end": 1987, + "start": 1991, + "end": 1992, "ctxt": 0 }, "value": "x", @@ -2701,8 +2701,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 1992, - "end": 1996, + "start": 1997, + "end": 2001, "ctxt": 0 } } @@ -2711,23 +2711,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 1998, - "end": 2027, + "start": 2003, + "end": 2032, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2008, - "end": 2010, + "start": 2013, + "end": 2015, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2008, - "end": 2009, + "start": 2013, + "end": 2014, "ctxt": 0 }, "value": "x", @@ -2739,23 +2739,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 2037, - "end": 2061, + "start": 2042, + "end": 2066, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2047, - "end": 2049, + "start": 2052, + "end": 2054, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2047, - "end": 2048, + "start": 2052, + "end": 2053, "ctxt": 0 }, "value": "x", @@ -2768,23 +2768,23 @@ { "type": "IfStatement", "span": { - "start": 2066, - "end": 2149, + "start": 2071, + "end": 2154, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 2070, - "end": 2084, + "start": 2075, + "end": 2089, "ctxt": 0 }, "operator": "!=", "left": { "type": "Identifier", "span": { - "start": 2070, - "end": 2071, + "start": 2075, + "end": 2076, "ctxt": 0 }, "value": "x", @@ -2793,8 +2793,8 @@ "right": { "type": "Identifier", "span": { - "start": 2075, - "end": 2084, + "start": 2080, + "end": 2089, "ctxt": 0 }, "value": "undefined", @@ -2804,23 +2804,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 2086, - "end": 2115, + "start": 2091, + "end": 2120, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2096, - "end": 2098, + "start": 2101, + "end": 2103, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2096, - "end": 2097, + "start": 2101, + "end": 2102, "ctxt": 0 }, "value": "x", @@ -2832,23 +2832,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 2125, - "end": 2149, + "start": 2130, + "end": 2154, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2135, - "end": 2137, + "start": 2140, + "end": 2142, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2135, - "end": 2136, + "start": 2140, + "end": 2141, "ctxt": 0 }, "value": "x", @@ -2861,23 +2861,23 @@ { "type": "IfStatement", "span": { - "start": 2154, - "end": 2232, + "start": 2159, + "end": 2237, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 2158, - "end": 2167, + "start": 2163, + "end": 2172, "ctxt": 0 }, "operator": "!=", "left": { "type": "Identifier", "span": { - "start": 2158, - "end": 2159, + "start": 2163, + "end": 2164, "ctxt": 0 }, "value": "x", @@ -2886,8 +2886,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 2163, - "end": 2167, + "start": 2168, + "end": 2172, "ctxt": 0 } } @@ -2895,23 +2895,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 2169, - "end": 2198, + "start": 2174, + "end": 2203, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2179, - "end": 2181, + "start": 2184, + "end": 2186, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2179, - "end": 2180, + "start": 2184, + "end": 2185, "ctxt": 0 }, "value": "x", @@ -2923,23 +2923,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 2208, - "end": 2232, + "start": 2213, + "end": 2237, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2218, - "end": 2220, + "start": 2223, + "end": 2225, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2218, - "end": 2219, + "start": 2223, + "end": 2224, "ctxt": 0 }, "value": "x", @@ -2956,23 +2956,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 1751, - "end": 1754, + "start": 1756, + "end": 1759, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 1752, - "end": 1753, + "start": 1757, + "end": 1758, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 1752, - "end": 1753, + "start": 1757, + "end": 1758, "ctxt": 0 }, "value": "T", @@ -2993,8 +2993,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 2245, - "end": 2248, + "start": 2250, + "end": 2253, "ctxt": 0 }, "value": "f22", @@ -3005,16 +3005,16 @@ { "type": "Parameter", "span": { - "start": 2275, - "end": 2279, + "start": 2280, + "end": 2284, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 2275, - "end": 2279, + "start": 2280, + "end": 2284, "ctxt": 0 }, "value": "x", @@ -3022,22 +3022,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 2276, - "end": 2279, + "start": 2281, + "end": 2284, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 2278, - "end": 2279, + "start": 2283, + "end": 2284, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 2278, - "end": 2279, + "start": 2283, + "end": 2284, "ctxt": 0 }, "value": "T", @@ -3051,38 +3051,38 @@ ], "decorators": [], "span": { - "start": 2236, - "end": 2726, + "start": 2241, + "end": 2731, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 2281, - "end": 2726, + "start": 2286, + "end": 2731, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 2287, - "end": 2371, + "start": 2292, + "end": 2376, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 2291, - "end": 2306, + "start": 2296, + "end": 2311, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 2291, - "end": 2292, + "start": 2296, + "end": 2297, "ctxt": 0 }, "value": "x", @@ -3091,8 +3091,8 @@ "right": { "type": "Identifier", "span": { - "start": 2297, - "end": 2306, + "start": 2302, + "end": 2311, "ctxt": 0 }, "value": "undefined", @@ -3102,23 +3102,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 2308, - "end": 2337, + "start": 2313, + "end": 2342, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2318, - "end": 2320, + "start": 2323, + "end": 2325, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2318, - "end": 2319, + "start": 2323, + "end": 2324, "ctxt": 0 }, "value": "x", @@ -3130,23 +3130,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 2347, - "end": 2371, + "start": 2352, + "end": 2376, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2357, - "end": 2359, + "start": 2362, + "end": 2364, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2357, - "end": 2358, + "start": 2362, + "end": 2363, "ctxt": 0 }, "value": "x", @@ -3159,23 +3159,23 @@ { "type": "IfStatement", "span": { - "start": 2376, - "end": 2450, + "start": 2381, + "end": 2455, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 2380, - "end": 2390, + "start": 2385, + "end": 2395, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 2380, - "end": 2381, + "start": 2385, + "end": 2386, "ctxt": 0 }, "value": "x", @@ -3184,8 +3184,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 2386, - "end": 2390, + "start": 2391, + "end": 2395, "ctxt": 0 } } @@ -3193,23 +3193,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 2392, - "end": 2416, + "start": 2397, + "end": 2421, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2402, - "end": 2404, + "start": 2407, + "end": 2409, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2402, - "end": 2403, + "start": 2407, + "end": 2408, "ctxt": 0 }, "value": "x", @@ -3221,23 +3221,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 2426, - "end": 2450, + "start": 2431, + "end": 2455, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2436, - "end": 2438, + "start": 2441, + "end": 2443, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2436, - "end": 2437, + "start": 2441, + "end": 2442, "ctxt": 0 }, "value": "x", @@ -3250,31 +3250,31 @@ { "type": "IfStatement", "span": { - "start": 2455, - "end": 2553, + "start": 2460, + "end": 2558, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 2459, - "end": 2488, + "start": 2464, + "end": 2493, "ctxt": 0 }, "operator": "&&", "left": { "type": "BinaryExpression", "span": { - "start": 2459, - "end": 2474, + "start": 2464, + "end": 2479, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 2459, - "end": 2460, + "start": 2464, + "end": 2465, "ctxt": 0 }, "value": "x", @@ -3283,8 +3283,8 @@ "right": { "type": "Identifier", "span": { - "start": 2465, - "end": 2474, + "start": 2470, + "end": 2479, "ctxt": 0 }, "value": "undefined", @@ -3294,16 +3294,16 @@ "right": { "type": "BinaryExpression", "span": { - "start": 2478, - "end": 2488, + "start": 2483, + "end": 2493, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 2478, - "end": 2479, + "start": 2483, + "end": 2484, "ctxt": 0 }, "value": "x", @@ -3312,8 +3312,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 2484, - "end": 2488, + "start": 2489, + "end": 2493, "ctxt": 0 } } @@ -3322,23 +3322,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 2490, - "end": 2519, + "start": 2495, + "end": 2524, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2500, - "end": 2502, + "start": 2505, + "end": 2507, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2500, - "end": 2501, + "start": 2505, + "end": 2506, "ctxt": 0 }, "value": "x", @@ -3350,23 +3350,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 2529, - "end": 2553, + "start": 2534, + "end": 2558, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2539, - "end": 2541, + "start": 2544, + "end": 2546, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2539, - "end": 2540, + "start": 2544, + "end": 2545, "ctxt": 0 }, "value": "x", @@ -3379,23 +3379,23 @@ { "type": "IfStatement", "span": { - "start": 2558, - "end": 2641, + "start": 2563, + "end": 2646, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 2562, - "end": 2576, + "start": 2567, + "end": 2581, "ctxt": 0 }, "operator": "!=", "left": { "type": "Identifier", "span": { - "start": 2562, - "end": 2563, + "start": 2567, + "end": 2568, "ctxt": 0 }, "value": "x", @@ -3404,8 +3404,8 @@ "right": { "type": "Identifier", "span": { - "start": 2567, - "end": 2576, + "start": 2572, + "end": 2581, "ctxt": 0 }, "value": "undefined", @@ -3415,23 +3415,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 2578, - "end": 2607, + "start": 2583, + "end": 2612, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2588, - "end": 2590, + "start": 2593, + "end": 2595, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2588, - "end": 2589, + "start": 2593, + "end": 2594, "ctxt": 0 }, "value": "x", @@ -3443,23 +3443,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 2617, - "end": 2641, + "start": 2622, + "end": 2646, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2627, - "end": 2629, + "start": 2632, + "end": 2634, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2627, - "end": 2628, + "start": 2632, + "end": 2633, "ctxt": 0 }, "value": "x", @@ -3472,23 +3472,23 @@ { "type": "IfStatement", "span": { - "start": 2646, - "end": 2724, + "start": 2651, + "end": 2729, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 2650, - "end": 2659, + "start": 2655, + "end": 2664, "ctxt": 0 }, "operator": "!=", "left": { "type": "Identifier", "span": { - "start": 2650, - "end": 2651, + "start": 2655, + "end": 2656, "ctxt": 0 }, "value": "x", @@ -3497,8 +3497,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 2655, - "end": 2659, + "start": 2660, + "end": 2664, "ctxt": 0 } } @@ -3506,23 +3506,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 2661, - "end": 2690, + "start": 2666, + "end": 2695, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2671, - "end": 2673, + "start": 2676, + "end": 2678, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2671, - "end": 2672, + "start": 2676, + "end": 2677, "ctxt": 0 }, "value": "x", @@ -3534,23 +3534,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 2700, - "end": 2724, + "start": 2705, + "end": 2729, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2710, - "end": 2712, + "start": 2715, + "end": 2717, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2710, - "end": 2711, + "start": 2715, + "end": 2716, "ctxt": 0 }, "value": "x", @@ -3567,23 +3567,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 2248, - "end": 2274, + "start": 2253, + "end": 2279, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 2249, - "end": 2273, + "start": 2254, + "end": 2278, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 2249, - "end": 2250, + "start": 2254, + "end": 2255, "ctxt": 0 }, "value": "T", @@ -3595,16 +3595,16 @@ "constraint": { "type": "TsUnionType", "span": { - "start": 2259, - "end": 2273, + "start": 2264, + "end": 2278, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 2259, - "end": 2261, + "start": 2264, + "end": 2266, "ctxt": 0 }, "members": [] @@ -3612,8 +3612,8 @@ { "type": "TsKeywordType", "span": { - "start": 2264, - "end": 2273, + "start": 2269, + "end": 2278, "ctxt": 0 }, "kind": "undefined" @@ -3631,8 +3631,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 2737, - "end": 2740, + "start": 2742, + "end": 2745, "ctxt": 0 }, "value": "f23", @@ -3643,16 +3643,16 @@ { "type": "Parameter", "span": { - "start": 2744, - "end": 2767, + "start": 2749, + "end": 2772, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 2744, - "end": 2767, + "start": 2749, + "end": 2772, "ctxt": 0 }, "value": "x", @@ -3660,30 +3660,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 2745, - "end": 2767, + "start": 2750, + "end": 2772, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 2747, - "end": 2767, + "start": 2752, + "end": 2772, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 2747, - "end": 2748, + "start": 2752, + "end": 2753, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 2747, - "end": 2748, + "start": 2752, + "end": 2753, "ctxt": 0 }, "value": "T", @@ -3694,8 +3694,8 @@ { "type": "TsKeywordType", "span": { - "start": 2751, - "end": 2760, + "start": 2756, + "end": 2765, "ctxt": 0 }, "kind": "undefined" @@ -3703,8 +3703,8 @@ { "type": "TsKeywordType", "span": { - "start": 2763, - "end": 2767, + "start": 2768, + "end": 2772, "ctxt": 0 }, "kind": "null" @@ -3717,38 +3717,38 @@ ], "decorators": [], "span": { - "start": 2728, - "end": 2999, + "start": 2733, + "end": 3004, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 2769, - "end": 2999, + "start": 2774, + "end": 3004, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 2775, - "end": 2832, + "start": 2780, + "end": 2837, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 2779, - "end": 2794, + "start": 2784, + "end": 2799, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 2779, - "end": 2780, + "start": 2784, + "end": 2785, "ctxt": 0 }, "value": "x", @@ -3757,8 +3757,8 @@ "right": { "type": "Identifier", "span": { - "start": 2785, - "end": 2794, + "start": 2790, + "end": 2799, "ctxt": 0 }, "value": "undefined", @@ -3768,23 +3768,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 2796, - "end": 2832, + "start": 2801, + "end": 2837, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2806, - "end": 2808, + "start": 2811, + "end": 2813, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2806, - "end": 2807, + "start": 2811, + "end": 2812, "ctxt": 0 }, "value": "x", @@ -3798,23 +3798,23 @@ { "type": "IfStatement", "span": { - "start": 2837, - "end": 2894, + "start": 2842, + "end": 2899, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 2841, - "end": 2851, + "start": 2846, + "end": 2856, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 2841, - "end": 2842, + "start": 2846, + "end": 2847, "ctxt": 0 }, "value": "x", @@ -3823,8 +3823,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 2847, - "end": 2851, + "start": 2852, + "end": 2856, "ctxt": 0 } } @@ -3832,23 +3832,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 2853, - "end": 2894, + "start": 2858, + "end": 2899, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2863, - "end": 2865, + "start": 2868, + "end": 2870, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2863, - "end": 2864, + "start": 2868, + "end": 2869, "ctxt": 0 }, "value": "x", @@ -3862,23 +3862,23 @@ { "type": "IfStatement", "span": { - "start": 2899, - "end": 2948, + "start": 2904, + "end": 2953, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 2903, - "end": 2917, + "start": 2908, + "end": 2922, "ctxt": 0 }, "operator": "!=", "left": { "type": "Identifier", "span": { - "start": 2903, - "end": 2904, + "start": 2908, + "end": 2909, "ctxt": 0 }, "value": "x", @@ -3887,8 +3887,8 @@ "right": { "type": "Identifier", "span": { - "start": 2908, - "end": 2917, + "start": 2913, + "end": 2922, "ctxt": 0 }, "value": "undefined", @@ -3898,23 +3898,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 2919, - "end": 2948, + "start": 2924, + "end": 2953, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2929, - "end": 2931, + "start": 2934, + "end": 2936, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2929, - "end": 2930, + "start": 2934, + "end": 2935, "ctxt": 0 }, "value": "x", @@ -3928,23 +3928,23 @@ { "type": "IfStatement", "span": { - "start": 2953, - "end": 2997, + "start": 2958, + "end": 3002, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 2957, - "end": 2966, + "start": 2962, + "end": 2971, "ctxt": 0 }, "operator": "!=", "left": { "type": "Identifier", "span": { - "start": 2957, - "end": 2958, + "start": 2962, + "end": 2963, "ctxt": 0 }, "value": "x", @@ -3953,8 +3953,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 2962, - "end": 2966, + "start": 2967, + "end": 2971, "ctxt": 0 } } @@ -3962,23 +3962,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 2968, - "end": 2997, + "start": 2973, + "end": 3002, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 2978, - "end": 2980, + "start": 2983, + "end": 2985, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 2978, - "end": 2979, + "start": 2983, + "end": 2984, "ctxt": 0 }, "value": "x", @@ -3996,23 +3996,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 2740, - "end": 2743, + "start": 2745, + "end": 2748, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 2741, - "end": 2742, + "start": 2746, + "end": 2747, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 2741, - "end": 2742, + "start": 2746, + "end": 2747, "ctxt": 0 }, "value": "T", @@ -4033,8 +4033,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 3010, - "end": 3013, + "start": 3015, + "end": 3018, "ctxt": 0 }, "value": "f30", @@ -4045,16 +4045,16 @@ { "type": "Parameter", "span": { - "start": 3014, - "end": 3019, + "start": 3019, + "end": 3024, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 3014, - "end": 3019, + "start": 3019, + "end": 3024, "ctxt": 0 }, "value": "x", @@ -4062,15 +4062,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 3015, - "end": 3019, + "start": 3020, + "end": 3024, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeLiteral", "span": { - "start": 3017, - "end": 3019, + "start": 3022, + "end": 3024, "ctxt": 0 }, "members": [] @@ -4081,46 +4081,46 @@ ], "decorators": [], "span": { - "start": 3001, - "end": 3085, + "start": 3006, + "end": 3090, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 3021, - "end": 3085, + "start": 3026, + "end": 3090, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 3027, - "end": 3083, + "start": 3032, + "end": 3088, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 3031, - "end": 3052, + "start": 3036, + "end": 3057, "ctxt": 0 }, "operator": "===", "left": { "type": "UnaryExpression", "span": { - "start": 3031, - "end": 3039, + "start": 3036, + "end": 3044, "ctxt": 0 }, "operator": "typeof", "argument": { "type": "Identifier", "span": { - "start": 3038, - "end": 3039, + "start": 3043, + "end": 3044, "ctxt": 0 }, "value": "x", @@ -4130,8 +4130,8 @@ "right": { "type": "StringLiteral", "span": { - "start": 3044, - "end": 3052, + "start": 3049, + "end": 3057, "ctxt": 0 }, "value": "object", @@ -4141,23 +4141,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 3054, - "end": 3083, + "start": 3059, + "end": 3088, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 3064, - "end": 3066, + "start": 3069, + "end": 3071, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 3064, - "end": 3065, + "start": 3069, + "end": 3070, "ctxt": 0 }, "value": "x", @@ -4180,8 +4180,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 3096, - "end": 3099, + "start": 3101, + "end": 3104, "ctxt": 0 }, "value": "f31", @@ -4192,16 +4192,16 @@ { "type": "Parameter", "span": { - "start": 3103, - "end": 3107, + "start": 3108, + "end": 3112, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 3103, - "end": 3107, + "start": 3108, + "end": 3112, "ctxt": 0 }, "value": "x", @@ -4209,22 +4209,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 3104, - "end": 3107, + "start": 3109, + "end": 3112, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 3106, - "end": 3107, + "start": 3111, + "end": 3112, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 3106, - "end": 3107, + "start": 3111, + "end": 3112, "ctxt": 0 }, "value": "T", @@ -4238,46 +4238,46 @@ ], "decorators": [], "span": { - "start": 3087, - "end": 3328, + "start": 3092, + "end": 3333, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 3109, - "end": 3328, + "start": 3114, + "end": 3333, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 3115, - "end": 3186, + "start": 3120, + "end": 3191, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 3119, - "end": 3140, + "start": 3124, + "end": 3145, "ctxt": 0 }, "operator": "===", "left": { "type": "UnaryExpression", "span": { - "start": 3119, - "end": 3127, + "start": 3124, + "end": 3132, "ctxt": 0 }, "operator": "typeof", "argument": { "type": "Identifier", "span": { - "start": 3126, - "end": 3127, + "start": 3131, + "end": 3132, "ctxt": 0 }, "value": "x", @@ -4287,8 +4287,8 @@ "right": { "type": "StringLiteral", "span": { - "start": 3132, - "end": 3140, + "start": 3137, + "end": 3145, "ctxt": 0 }, "value": "object", @@ -4298,23 +4298,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 3142, - "end": 3186, + "start": 3147, + "end": 3191, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 3152, - "end": 3154, + "start": 3157, + "end": 3159, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 3152, - "end": 3153, + "start": 3157, + "end": 3158, "ctxt": 0 }, "value": "x", @@ -4328,23 +4328,23 @@ { "type": "IfStatement", "span": { - "start": 3191, - "end": 3256, + "start": 3196, + "end": 3261, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 3195, - "end": 3221, + "start": 3200, + "end": 3226, "ctxt": 0 }, "operator": "&&", "left": { "type": "Identifier", "span": { - "start": 3195, - "end": 3196, + "start": 3200, + "end": 3201, "ctxt": 0 }, "value": "x", @@ -4353,24 +4353,24 @@ "right": { "type": "BinaryExpression", "span": { - "start": 3200, - "end": 3221, + "start": 3205, + "end": 3226, "ctxt": 0 }, "operator": "===", "left": { "type": "UnaryExpression", "span": { - "start": 3200, - "end": 3208, + "start": 3205, + "end": 3213, "ctxt": 0 }, "operator": "typeof", "argument": { "type": "Identifier", "span": { - "start": 3207, - "end": 3208, + "start": 3212, + "end": 3213, "ctxt": 0 }, "value": "x", @@ -4380,8 +4380,8 @@ "right": { "type": "StringLiteral", "span": { - "start": 3213, - "end": 3221, + "start": 3218, + "end": 3226, "ctxt": 0 }, "value": "object", @@ -4392,23 +4392,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 3223, - "end": 3256, + "start": 3228, + "end": 3261, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 3233, - "end": 3235, + "start": 3238, + "end": 3240, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 3233, - "end": 3234, + "start": 3238, + "end": 3239, "ctxt": 0 }, "value": "x", @@ -4422,39 +4422,39 @@ { "type": "IfStatement", "span": { - "start": 3261, - "end": 3326, + "start": 3266, + "end": 3331, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 3265, - "end": 3291, + "start": 3270, + "end": 3296, "ctxt": 0 }, "operator": "&&", "left": { "type": "BinaryExpression", "span": { - "start": 3265, - "end": 3286, + "start": 3270, + "end": 3291, "ctxt": 0 }, "operator": "===", "left": { "type": "UnaryExpression", "span": { - "start": 3265, - "end": 3273, + "start": 3270, + "end": 3278, "ctxt": 0 }, "operator": "typeof", "argument": { "type": "Identifier", "span": { - "start": 3272, - "end": 3273, + "start": 3277, + "end": 3278, "ctxt": 0 }, "value": "x", @@ -4464,8 +4464,8 @@ "right": { "type": "StringLiteral", "span": { - "start": 3278, - "end": 3286, + "start": 3283, + "end": 3291, "ctxt": 0 }, "value": "object", @@ -4475,8 +4475,8 @@ "right": { "type": "Identifier", "span": { - "start": 3290, - "end": 3291, + "start": 3295, + "end": 3296, "ctxt": 0 }, "value": "x", @@ -4486,23 +4486,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 3293, - "end": 3326, + "start": 3298, + "end": 3331, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 3303, - "end": 3305, + "start": 3308, + "end": 3310, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 3303, - "end": 3304, + "start": 3308, + "end": 3309, "ctxt": 0 }, "value": "x", @@ -4520,23 +4520,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 3099, - "end": 3102, + "start": 3104, + "end": 3107, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 3100, - "end": 3101, + "start": 3105, + "end": 3106, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 3100, - "end": 3101, + "start": 3105, + "end": 3106, "ctxt": 0 }, "value": "T", @@ -4557,8 +4557,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 3339, - "end": 3342, + "start": 3344, + "end": 3347, "ctxt": 0 }, "value": "f32", @@ -4569,16 +4569,16 @@ { "type": "Parameter", "span": { - "start": 3369, - "end": 3373, + "start": 3374, + "end": 3378, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 3369, - "end": 3373, + "start": 3374, + "end": 3378, "ctxt": 0 }, "value": "x", @@ -4586,22 +4586,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 3370, - "end": 3373, + "start": 3375, + "end": 3378, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 3372, - "end": 3373, + "start": 3377, + "end": 3378, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 3372, - "end": 3373, + "start": 3377, + "end": 3378, "ctxt": 0 }, "value": "T", @@ -4615,46 +4615,46 @@ ], "decorators": [], "span": { - "start": 3330, - "end": 3443, + "start": 3335, + "end": 3448, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 3375, - "end": 3443, + "start": 3380, + "end": 3448, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 3381, - "end": 3441, + "start": 3386, + "end": 3446, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 3385, - "end": 3406, + "start": 3390, + "end": 3411, "ctxt": 0 }, "operator": "===", "left": { "type": "UnaryExpression", "span": { - "start": 3385, - "end": 3393, + "start": 3390, + "end": 3398, "ctxt": 0 }, "operator": "typeof", "argument": { "type": "Identifier", "span": { - "start": 3392, - "end": 3393, + "start": 3397, + "end": 3398, "ctxt": 0 }, "value": "x", @@ -4664,8 +4664,8 @@ "right": { "type": "StringLiteral", "span": { - "start": 3398, - "end": 3406, + "start": 3403, + "end": 3411, "ctxt": 0 }, "value": "object", @@ -4675,23 +4675,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 3408, - "end": 3441, + "start": 3413, + "end": 3446, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 3418, - "end": 3420, + "start": 3423, + "end": 3425, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 3418, - "end": 3419, + "start": 3423, + "end": 3424, "ctxt": 0 }, "value": "x", @@ -4709,23 +4709,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 3342, - "end": 3368, + "start": 3347, + "end": 3373, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 3343, - "end": 3367, + "start": 3348, + "end": 3372, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 3343, - "end": 3344, + "start": 3348, + "end": 3349, "ctxt": 0 }, "value": "T", @@ -4737,16 +4737,16 @@ "constraint": { "type": "TsUnionType", "span": { - "start": 3353, - "end": 3367, + "start": 3358, + "end": 3372, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 3353, - "end": 3355, + "start": 3358, + "end": 3360, "ctxt": 0 }, "members": [] @@ -4754,8 +4754,8 @@ { "type": "TsKeywordType", "span": { - "start": 3358, - "end": 3367, + "start": 3363, + "end": 3372, "ctxt": 0 }, "kind": "undefined" @@ -4773,8 +4773,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 3454, - "end": 3466, + "start": 3459, + "end": 3471, "ctxt": 0 }, "value": "possiblyNull", @@ -4785,16 +4785,16 @@ { "type": "Parameter", "span": { - "start": 3470, - "end": 3474, + "start": 3475, + "end": 3479, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 3470, - "end": 3474, + "start": 3475, + "end": 3479, "ctxt": 0 }, "value": "x", @@ -4802,22 +4802,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 3471, - "end": 3474, + "start": 3476, + "end": 3479, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 3473, - "end": 3474, + "start": 3478, + "end": 3479, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 3473, - "end": 3474, + "start": 3478, + "end": 3479, "ctxt": 0 }, "value": "T", @@ -4831,53 +4831,53 @@ ], "decorators": [], "span": { - "start": 3445, - "end": 3522, + "start": 3450, + "end": 3527, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 3476, - "end": 3522, + "start": 3481, + "end": 3527, "ctxt": 0 }, "stmts": [ { "type": "ReturnStatement", "span": { - "start": 3482, - "end": 3507, + "start": 3487, + "end": 3512, "ctxt": 0 }, "argument": { "type": "ConditionalExpression", "span": { - "start": 3489, - "end": 3506, + "start": 3494, + "end": 3511, "ctxt": 0 }, "test": { "type": "UnaryExpression", "span": { - "start": 3489, - "end": 3495, + "start": 3494, + "end": 3500, "ctxt": 0 }, "operator": "!", "argument": { "type": "UnaryExpression", "span": { - "start": 3490, - "end": 3495, + "start": 3495, + "end": 3500, "ctxt": 0 }, "operator": "!", "argument": { "type": "BooleanLiteral", "span": { - "start": 3491, - "end": 3495, + "start": 3496, + "end": 3500, "ctxt": 0 }, "value": true @@ -4887,8 +4887,8 @@ "consequent": { "type": "Identifier", "span": { - "start": 3498, - "end": 3499, + "start": 3503, + "end": 3504, "ctxt": 0 }, "value": "x", @@ -4897,8 +4897,8 @@ "alternate": { "type": "NullLiteral", "span": { - "start": 3502, - "end": 3506, + "start": 3507, + "end": 3511, "ctxt": 0 } } @@ -4911,23 +4911,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 3466, - "end": 3469, + "start": 3471, + "end": 3474, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 3467, - "end": 3468, + "start": 3472, + "end": 3473, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 3467, - "end": 3468, + "start": 3472, + "end": 3473, "ctxt": 0 }, "value": "T", @@ -4948,8 +4948,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 3533, - "end": 3550, + "start": 3538, + "end": 3555, "ctxt": 0 }, "value": "possiblyUndefined", @@ -4960,16 +4960,16 @@ { "type": "Parameter", "span": { - "start": 3554, - "end": 3558, + "start": 3559, + "end": 3563, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 3554, - "end": 3558, + "start": 3559, + "end": 3563, "ctxt": 0 }, "value": "x", @@ -4977,22 +4977,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 3555, - "end": 3558, + "start": 3560, + "end": 3563, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 3557, - "end": 3558, + "start": 3562, + "end": 3563, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 3557, - "end": 3558, + "start": 3562, + "end": 3563, "ctxt": 0 }, "value": "T", @@ -5006,53 +5006,53 @@ ], "decorators": [], "span": { - "start": 3524, - "end": 3616, + "start": 3529, + "end": 3621, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 3560, - "end": 3616, + "start": 3565, + "end": 3621, "ctxt": 0 }, "stmts": [ { "type": "ReturnStatement", "span": { - "start": 3566, - "end": 3596, + "start": 3571, + "end": 3601, "ctxt": 0 }, "argument": { "type": "ConditionalExpression", "span": { - "start": 3573, - "end": 3595, + "start": 3578, + "end": 3600, "ctxt": 0 }, "test": { "type": "UnaryExpression", "span": { - "start": 3573, - "end": 3579, + "start": 3578, + "end": 3584, "ctxt": 0 }, "operator": "!", "argument": { "type": "UnaryExpression", "span": { - "start": 3574, - "end": 3579, + "start": 3579, + "end": 3584, "ctxt": 0 }, "operator": "!", "argument": { "type": "BooleanLiteral", "span": { - "start": 3575, - "end": 3579, + "start": 3580, + "end": 3584, "ctxt": 0 }, "value": true @@ -5062,8 +5062,8 @@ "consequent": { "type": "Identifier", "span": { - "start": 3582, - "end": 3583, + "start": 3587, + "end": 3588, "ctxt": 0 }, "value": "x", @@ -5072,8 +5072,8 @@ "alternate": { "type": "Identifier", "span": { - "start": 3586, - "end": 3595, + "start": 3591, + "end": 3600, "ctxt": 0 }, "value": "undefined", @@ -5088,23 +5088,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 3550, - "end": 3553, + "start": 3555, + "end": 3558, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 3551, - "end": 3552, + "start": 3556, + "end": 3557, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 3551, - "end": 3552, + "start": 3556, + "end": 3557, "ctxt": 0 }, "value": "T", @@ -5125,8 +5125,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 3627, - "end": 3650, + "start": 3632, + "end": 3655, "ctxt": 0 }, "value": "possiblyNullOrUndefined", @@ -5137,16 +5137,16 @@ { "type": "Parameter", "span": { - "start": 3654, - "end": 3658, + "start": 3659, + "end": 3663, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 3654, - "end": 3658, + "start": 3659, + "end": 3663, "ctxt": 0 }, "value": "x", @@ -5154,22 +5154,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 3655, - "end": 3658, + "start": 3660, + "end": 3663, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 3657, - "end": 3658, + "start": 3662, + "end": 3663, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 3657, - "end": 3658, + "start": 3662, + "end": 3663, "ctxt": 0 }, "value": "T", @@ -5183,37 +5183,37 @@ ], "decorators": [], "span": { - "start": 3618, - "end": 3735, + "start": 3623, + "end": 3740, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 3660, - "end": 3735, + "start": 3665, + "end": 3740, "ctxt": 0 }, "stmts": [ { "type": "ReturnStatement", "span": { - "start": 3666, - "end": 3708, + "start": 3671, + "end": 3713, "ctxt": 0 }, "argument": { "type": "CallExpression", "span": { - "start": 3673, - "end": 3707, + "start": 3678, + "end": 3712, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 3673, - "end": 3690, + "start": 3678, + "end": 3695, "ctxt": 0 }, "value": "possiblyUndefined", @@ -5225,15 +5225,15 @@ "expression": { "type": "CallExpression", "span": { - "start": 3691, - "end": 3706, + "start": 3696, + "end": 3711, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 3691, - "end": 3703, + "start": 3696, + "end": 3708, "ctxt": 0 }, "value": "possiblyNull", @@ -5245,8 +5245,8 @@ "expression": { "type": "Identifier", "span": { - "start": 3704, - "end": 3705, + "start": 3709, + "end": 3710, "ctxt": 0 }, "value": "x", @@ -5268,23 +5268,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 3650, - "end": 3653, + "start": 3655, + "end": 3658, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 3651, - "end": 3652, + "start": 3656, + "end": 3657, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 3651, - "end": 3652, + "start": 3656, + "end": 3657, "ctxt": 0 }, "value": "T", @@ -5305,8 +5305,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 3746, - "end": 3759, + "start": 3751, + "end": 3764, "ctxt": 0 }, "value": "ensureNotNull", @@ -5317,16 +5317,16 @@ { "type": "Parameter", "span": { - "start": 3763, - "end": 3767, + "start": 3768, + "end": 3772, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 3763, - "end": 3767, + "start": 3768, + "end": 3772, "ctxt": 0 }, "value": "x", @@ -5334,22 +5334,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 3764, - "end": 3767, + "start": 3769, + "end": 3772, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 3766, - "end": 3767, + "start": 3771, + "end": 3772, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 3766, - "end": 3767, + "start": 3771, + "end": 3772, "ctxt": 0 }, "value": "T", @@ -5363,38 +5363,38 @@ ], "decorators": [], "span": { - "start": 3737, - "end": 3846, + "start": 3742, + "end": 3851, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 3769, - "end": 3846, + "start": 3774, + "end": 3851, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 3775, - "end": 3805, + "start": 3780, + "end": 3810, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 3779, - "end": 3789, + "start": 3784, + "end": 3794, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 3779, - "end": 3780, + "start": 3784, + "end": 3785, "ctxt": 0 }, "value": "x", @@ -5403,8 +5403,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 3785, - "end": 3789, + "start": 3790, + "end": 3794, "ctxt": 0 } } @@ -5412,22 +5412,22 @@ "consequent": { "type": "ThrowStatement", "span": { - "start": 3791, - "end": 3805, + "start": 3796, + "end": 3810, "ctxt": 0 }, "argument": { "type": "CallExpression", "span": { - "start": 3797, - "end": 3804, + "start": 3802, + "end": 3809, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 3797, - "end": 3802, + "start": 3802, + "end": 3807, "ctxt": 0 }, "value": "Error", @@ -5442,15 +5442,15 @@ { "type": "ReturnStatement", "span": { - "start": 3810, - "end": 3819, + "start": 3815, + "end": 3824, "ctxt": 0 }, "argument": { "type": "Identifier", "span": { - "start": 3817, - "end": 3818, + "start": 3822, + "end": 3823, "ctxt": 0 }, "value": "x", @@ -5464,23 +5464,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 3759, - "end": 3762, + "start": 3764, + "end": 3767, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 3760, - "end": 3761, + "start": 3765, + "end": 3766, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 3760, - "end": 3761, + "start": 3765, + "end": 3766, "ctxt": 0 }, "value": "T", @@ -5501,8 +5501,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 3857, - "end": 3875, + "start": 3862, + "end": 3880, "ctxt": 0 }, "value": "ensureNotUndefined", @@ -5513,16 +5513,16 @@ { "type": "Parameter", "span": { - "start": 3879, - "end": 3883, + "start": 3884, + "end": 3888, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 3879, - "end": 3883, + "start": 3884, + "end": 3888, "ctxt": 0 }, "value": "x", @@ -5530,22 +5530,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 3880, - "end": 3883, + "start": 3885, + "end": 3888, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 3882, - "end": 3883, + "start": 3887, + "end": 3888, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 3882, - "end": 3883, + "start": 3887, + "end": 3888, "ctxt": 0 }, "value": "T", @@ -5559,38 +5559,38 @@ ], "decorators": [], "span": { - "start": 3848, - "end": 3962, + "start": 3853, + "end": 3967, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 3885, - "end": 3962, + "start": 3890, + "end": 3967, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 3891, - "end": 3926, + "start": 3896, + "end": 3931, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 3895, - "end": 3910, + "start": 3900, + "end": 3915, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 3895, - "end": 3896, + "start": 3900, + "end": 3901, "ctxt": 0 }, "value": "x", @@ -5599,8 +5599,8 @@ "right": { "type": "Identifier", "span": { - "start": 3901, - "end": 3910, + "start": 3906, + "end": 3915, "ctxt": 0 }, "value": "undefined", @@ -5610,22 +5610,22 @@ "consequent": { "type": "ThrowStatement", "span": { - "start": 3912, - "end": 3926, + "start": 3917, + "end": 3931, "ctxt": 0 }, "argument": { "type": "CallExpression", "span": { - "start": 3918, - "end": 3925, + "start": 3923, + "end": 3930, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 3918, - "end": 3923, + "start": 3923, + "end": 3928, "ctxt": 0 }, "value": "Error", @@ -5640,15 +5640,15 @@ { "type": "ReturnStatement", "span": { - "start": 3931, - "end": 3940, + "start": 3936, + "end": 3945, "ctxt": 0 }, "argument": { "type": "Identifier", "span": { - "start": 3938, - "end": 3939, + "start": 3943, + "end": 3944, "ctxt": 0 }, "value": "x", @@ -5662,23 +5662,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 3875, - "end": 3878, + "start": 3880, + "end": 3883, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 3876, - "end": 3877, + "start": 3881, + "end": 3882, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 3876, - "end": 3877, + "start": 3881, + "end": 3882, "ctxt": 0 }, "value": "T", @@ -5699,8 +5699,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 3973, - "end": 3997, + "start": 3978, + "end": 4002, "ctxt": 0 }, "value": "ensureNotNullOrUndefined", @@ -5711,16 +5711,16 @@ { "type": "Parameter", "span": { - "start": 4001, - "end": 4005, + "start": 4006, + "end": 4010, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 4001, - "end": 4005, + "start": 4006, + "end": 4010, "ctxt": 0 }, "value": "x", @@ -5728,22 +5728,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 4002, - "end": 4005, + "start": 4007, + "end": 4010, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 4004, - "end": 4005, + "start": 4009, + "end": 4010, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 4004, - "end": 4005, + "start": 4009, + "end": 4010, "ctxt": 0 }, "value": "T", @@ -5757,37 +5757,37 @@ ], "decorators": [], "span": { - "start": 3964, - "end": 4070, + "start": 3969, + "end": 4075, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 4007, - "end": 4070, + "start": 4012, + "end": 4075, "ctxt": 0 }, "stmts": [ { "type": "ReturnStatement", "span": { - "start": 4013, - "end": 4057, + "start": 4018, + "end": 4062, "ctxt": 0 }, "argument": { "type": "CallExpression", "span": { - "start": 4020, - "end": 4056, + "start": 4025, + "end": 4061, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4020, - "end": 4038, + "start": 4025, + "end": 4043, "ctxt": 0 }, "value": "ensureNotUndefined", @@ -5799,15 +5799,15 @@ "expression": { "type": "CallExpression", "span": { - "start": 4039, - "end": 4055, + "start": 4044, + "end": 4060, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4039, - "end": 4052, + "start": 4044, + "end": 4057, "ctxt": 0 }, "value": "ensureNotNull", @@ -5819,8 +5819,8 @@ "expression": { "type": "Identifier", "span": { - "start": 4053, - "end": 4054, + "start": 4058, + "end": 4059, "ctxt": 0 }, "value": "x", @@ -5842,23 +5842,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 3997, - "end": 4000, + "start": 4002, + "end": 4005, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 3998, - "end": 3999, + "start": 4003, + "end": 4004, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 3998, - "end": 3999, + "start": 4003, + "end": 4004, "ctxt": 0 }, "value": "T", @@ -5879,8 +5879,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 4081, - "end": 4084, + "start": 4086, + "end": 4089, "ctxt": 0 }, "value": "f40", @@ -5891,16 +5891,16 @@ { "type": "Parameter", "span": { - "start": 4085, - "end": 4106, + "start": 4090, + "end": 4111, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 4085, - "end": 4106, + "start": 4090, + "end": 4111, "ctxt": 0 }, "value": "a", @@ -5908,23 +5908,23 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 4086, - "end": 4106, + "start": 4091, + "end": 4111, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 4088, - "end": 4106, + "start": 4093, + "end": 4111, "ctxt": 0 }, "types": [ { "type": "TsKeywordType", "span": { - "start": 4088, - "end": 4094, + "start": 4093, + "end": 4099, "ctxt": 0 }, "kind": "string" @@ -5932,8 +5932,8 @@ { "type": "TsKeywordType", "span": { - "start": 4097, - "end": 4106, + "start": 4102, + "end": 4111, "ctxt": 0 }, "kind": "undefined" @@ -5946,16 +5946,16 @@ { "type": "Parameter", "span": { - "start": 4108, - "end": 4136, + "start": 4113, + "end": 4141, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 4108, - "end": 4136, + "start": 4113, + "end": 4141, "ctxt": 0 }, "value": "b", @@ -5963,23 +5963,23 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 4109, - "end": 4136, + "start": 4114, + "end": 4141, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 4111, - "end": 4136, + "start": 4116, + "end": 4141, "ctxt": 0 }, "types": [ { "type": "TsKeywordType", "span": { - "start": 4111, - "end": 4117, + "start": 4116, + "end": 4122, "ctxt": 0 }, "kind": "number" @@ -5987,8 +5987,8 @@ { "type": "TsKeywordType", "span": { - "start": 4120, - "end": 4124, + "start": 4125, + "end": 4129, "ctxt": 0 }, "kind": "null" @@ -5996,8 +5996,8 @@ { "type": "TsKeywordType", "span": { - "start": 4127, - "end": 4136, + "start": 4132, + "end": 4141, "ctxt": 0 }, "kind": "undefined" @@ -6010,23 +6010,23 @@ ], "decorators": [], "span": { - "start": 4072, - "end": 4247, + "start": 4077, + "end": 4252, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 4138, - "end": 4247, + "start": 4143, + "end": 4252, "ctxt": 0 }, "stmts": [ { "type": "VariableDeclaration", "span": { - "start": 4144, - "end": 4181, + "start": 4149, + "end": 4186, "ctxt": 0 }, "kind": "let", @@ -6035,15 +6035,15 @@ { "type": "VariableDeclarator", "span": { - "start": 4148, - "end": 4180, + "start": 4153, + "end": 4185, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 4148, - "end": 4150, + "start": 4153, + "end": 4155, "ctxt": 0 }, "value": "a1", @@ -6053,15 +6053,15 @@ "init": { "type": "CallExpression", "span": { - "start": 4153, - "end": 4180, + "start": 4158, + "end": 4185, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4153, - "end": 4177, + "start": 4158, + "end": 4182, "ctxt": 0 }, "value": "ensureNotNullOrUndefined", @@ -6073,8 +6073,8 @@ "expression": { "type": "Identifier", "span": { - "start": 4178, - "end": 4179, + "start": 4183, + "end": 4184, "ctxt": 0 }, "value": "a", @@ -6091,8 +6091,8 @@ { "type": "VariableDeclaration", "span": { - "start": 4197, - "end": 4234, + "start": 4202, + "end": 4239, "ctxt": 0 }, "kind": "let", @@ -6101,15 +6101,15 @@ { "type": "VariableDeclarator", "span": { - "start": 4201, - "end": 4233, + "start": 4206, + "end": 4238, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 4201, - "end": 4203, + "start": 4206, + "end": 4208, "ctxt": 0 }, "value": "b1", @@ -6119,15 +6119,15 @@ "init": { "type": "CallExpression", "span": { - "start": 4206, - "end": 4233, + "start": 4211, + "end": 4238, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4206, - "end": 4230, + "start": 4211, + "end": 4235, "ctxt": 0 }, "value": "ensureNotNullOrUndefined", @@ -6139,8 +6139,8 @@ "expression": { "type": "Identifier", "span": { - "start": 4231, - "end": 4232, + "start": 4236, + "end": 4237, "ctxt": 0 }, "value": "b", @@ -6164,16 +6164,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 4249, - "end": 4303, + "start": 4254, + "end": 4308, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 4254, - "end": 4256, + "start": 4259, + "end": 4261, "ctxt": 0 }, "value": "QQ", @@ -6182,23 +6182,23 @@ "typeParams": { "type": "TsTypeParameterDeclaration", "span": { - "start": 4256, - "end": 4259, + "start": 4261, + "end": 4264, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 4257, - "end": 4258, + "start": 4262, + "end": 4263, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 4257, - "end": 4258, + "start": 4262, + "end": 4263, "ctxt": 0 }, "value": "T", @@ -6215,15 +6215,15 @@ "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 4262, - "end": 4302, + "start": 4267, + "end": 4307, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 4262, - "end": 4273, + "start": 4267, + "end": 4278, "ctxt": 0 }, "value": "NonNullable", @@ -6232,23 +6232,23 @@ "typeParams": { "type": "TsTypeParameterInstantiation", "span": { - "start": 4273, - "end": 4302, + "start": 4278, + "end": 4307, "ctxt": 0 }, "params": [ { "type": "TsTypeReference", "span": { - "start": 4274, - "end": 4301, + "start": 4279, + "end": 4306, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 4274, - "end": 4285, + "start": 4279, + "end": 4290, "ctxt": 0 }, "value": "NonNullable", @@ -6257,23 +6257,23 @@ "typeParams": { "type": "TsTypeParameterInstantiation", "span": { - "start": 4285, - "end": 4301, + "start": 4290, + "end": 4306, "ctxt": 0 }, "params": [ { "type": "TsTypeReference", "span": { - "start": 4286, - "end": 4300, + "start": 4291, + "end": 4305, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 4286, - "end": 4297, + "start": 4291, + "end": 4302, "ctxt": 0 }, "value": "NonNullable", @@ -6282,23 +6282,23 @@ "typeParams": { "type": "TsTypeParameterInstantiation", "span": { - "start": 4297, - "end": 4300, + "start": 4302, + "end": 4305, "ctxt": 0 }, "params": [ { "type": "TsTypeReference", "span": { - "start": 4298, - "end": 4299, + "start": 4303, + "end": 4304, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 4298, - "end": 4299, + "start": 4303, + "end": 4304, "ctxt": 0 }, "value": "T", @@ -6321,8 +6321,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 4314, - "end": 4317, + "start": 4319, + "end": 4322, "ctxt": 0 }, "value": "f41", @@ -6333,16 +6333,16 @@ { "type": "Parameter", "span": { - "start": 4321, - "end": 4325, + "start": 4326, + "end": 4330, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 4321, - "end": 4325, + "start": 4326, + "end": 4330, "ctxt": 0 }, "value": "a", @@ -6350,22 +6350,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 4322, - "end": 4325, + "start": 4327, + "end": 4330, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 4324, - "end": 4325, + "start": 4329, + "end": 4330, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 4324, - "end": 4325, + "start": 4329, + "end": 4330, "ctxt": 0 }, "value": "T", @@ -6379,23 +6379,23 @@ ], "decorators": [], "span": { - "start": 4305, - "end": 4983, + "start": 4310, + "end": 4988, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 4327, - "end": 4983, + "start": 4332, + "end": 4988, "ctxt": 0 }, "stmts": [ { "type": "VariableDeclaration", "span": { - "start": 4333, - "end": 4379, + "start": 4338, + "end": 4384, "ctxt": 0 }, "kind": "let", @@ -6404,15 +6404,15 @@ { "type": "VariableDeclarator", "span": { - "start": 4337, - "end": 4378, + "start": 4342, + "end": 4383, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 4337, - "end": 4339, + "start": 4342, + "end": 4344, "ctxt": 0 }, "value": "a1", @@ -6422,15 +6422,15 @@ "init": { "type": "CallExpression", "span": { - "start": 4342, - "end": 4378, + "start": 4347, + "end": 4383, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4342, - "end": 4360, + "start": 4347, + "end": 4365, "ctxt": 0 }, "value": "ensureNotUndefined", @@ -6442,15 +6442,15 @@ "expression": { "type": "CallExpression", "span": { - "start": 4361, - "end": 4377, + "start": 4366, + "end": 4382, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4361, - "end": 4374, + "start": 4366, + "end": 4379, "ctxt": 0 }, "value": "ensureNotNull", @@ -6462,8 +6462,8 @@ "expression": { "type": "Identifier", "span": { - "start": 4375, - "end": 4376, + "start": 4380, + "end": 4381, "ctxt": 0 }, "value": "a", @@ -6484,8 +6484,8 @@ { "type": "VariableDeclaration", "span": { - "start": 4395, - "end": 4441, + "start": 4400, + "end": 4446, "ctxt": 0 }, "kind": "let", @@ -6494,15 +6494,15 @@ { "type": "VariableDeclarator", "span": { - "start": 4399, - "end": 4440, + "start": 4404, + "end": 4445, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 4399, - "end": 4401, + "start": 4404, + "end": 4406, "ctxt": 0 }, "value": "a2", @@ -6512,15 +6512,15 @@ "init": { "type": "CallExpression", "span": { - "start": 4404, - "end": 4440, + "start": 4409, + "end": 4445, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4404, - "end": 4417, + "start": 4409, + "end": 4422, "ctxt": 0 }, "value": "ensureNotNull", @@ -6532,15 +6532,15 @@ "expression": { "type": "CallExpression", "span": { - "start": 4418, - "end": 4439, + "start": 4423, + "end": 4444, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4418, - "end": 4436, + "start": 4423, + "end": 4441, "ctxt": 0 }, "value": "ensureNotUndefined", @@ -6552,8 +6552,8 @@ "expression": { "type": "Identifier", "span": { - "start": 4437, - "end": 4438, + "start": 4442, + "end": 4443, "ctxt": 0 }, "value": "a", @@ -6574,8 +6574,8 @@ { "type": "VariableDeclaration", "span": { - "start": 4457, - "end": 4498, + "start": 4462, + "end": 4503, "ctxt": 0 }, "kind": "let", @@ -6584,15 +6584,15 @@ { "type": "VariableDeclarator", "span": { - "start": 4461, - "end": 4497, + "start": 4466, + "end": 4502, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 4461, - "end": 4463, + "start": 4466, + "end": 4468, "ctxt": 0 }, "value": "a3", @@ -6602,15 +6602,15 @@ "init": { "type": "CallExpression", "span": { - "start": 4466, - "end": 4497, + "start": 4471, + "end": 4502, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4466, - "end": 4479, + "start": 4471, + "end": 4484, "ctxt": 0 }, "value": "ensureNotNull", @@ -6622,15 +6622,15 @@ "expression": { "type": "CallExpression", "span": { - "start": 4480, - "end": 4496, + "start": 4485, + "end": 4501, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4480, - "end": 4493, + "start": 4485, + "end": 4498, "ctxt": 0 }, "value": "ensureNotNull", @@ -6642,8 +6642,8 @@ "expression": { "type": "Identifier", "span": { - "start": 4494, - "end": 4495, + "start": 4499, + "end": 4500, "ctxt": 0 }, "value": "a", @@ -6664,8 +6664,8 @@ { "type": "VariableDeclaration", "span": { - "start": 4530, - "end": 4581, + "start": 4535, + "end": 4586, "ctxt": 0 }, "kind": "let", @@ -6674,15 +6674,15 @@ { "type": "VariableDeclarator", "span": { - "start": 4534, - "end": 4580, + "start": 4539, + "end": 4585, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 4534, - "end": 4536, + "start": 4539, + "end": 4541, "ctxt": 0 }, "value": "a4", @@ -6692,15 +6692,15 @@ "init": { "type": "CallExpression", "span": { - "start": 4539, - "end": 4580, + "start": 4544, + "end": 4585, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4539, - "end": 4557, + "start": 4544, + "end": 4562, "ctxt": 0 }, "value": "ensureNotUndefined", @@ -6712,15 +6712,15 @@ "expression": { "type": "CallExpression", "span": { - "start": 4558, - "end": 4579, + "start": 4563, + "end": 4584, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4558, - "end": 4576, + "start": 4563, + "end": 4581, "ctxt": 0 }, "value": "ensureNotUndefined", @@ -6732,8 +6732,8 @@ "expression": { "type": "Identifier", "span": { - "start": 4577, - "end": 4578, + "start": 4582, + "end": 4583, "ctxt": 0 }, "value": "a", @@ -6754,8 +6754,8 @@ { "type": "VariableDeclaration", "span": { - "start": 4608, - "end": 4671, + "start": 4613, + "end": 4676, "ctxt": 0 }, "kind": "let", @@ -6764,15 +6764,15 @@ { "type": "VariableDeclarator", "span": { - "start": 4612, - "end": 4670, + "start": 4617, + "end": 4675, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 4612, - "end": 4614, + "start": 4617, + "end": 4619, "ctxt": 0 }, "value": "a5", @@ -6782,15 +6782,15 @@ "init": { "type": "CallExpression", "span": { - "start": 4617, - "end": 4670, + "start": 4622, + "end": 4675, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4617, - "end": 4641, + "start": 4622, + "end": 4646, "ctxt": 0 }, "value": "ensureNotNullOrUndefined", @@ -6802,15 +6802,15 @@ "expression": { "type": "CallExpression", "span": { - "start": 4642, - "end": 4669, + "start": 4647, + "end": 4674, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4642, - "end": 4666, + "start": 4647, + "end": 4671, "ctxt": 0 }, "value": "ensureNotNullOrUndefined", @@ -6822,8 +6822,8 @@ "expression": { "type": "Identifier", "span": { - "start": 4667, - "end": 4668, + "start": 4672, + "end": 4673, "ctxt": 0 }, "value": "a", @@ -6844,8 +6844,8 @@ { "type": "VariableDeclaration", "span": { - "start": 4687, - "end": 4738, + "start": 4692, + "end": 4743, "ctxt": 0 }, "kind": "let", @@ -6854,15 +6854,15 @@ { "type": "VariableDeclarator", "span": { - "start": 4691, - "end": 4737, + "start": 4696, + "end": 4742, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 4691, - "end": 4693, + "start": 4696, + "end": 4698, "ctxt": 0 }, "value": "a6", @@ -6872,15 +6872,15 @@ "init": { "type": "CallExpression", "span": { - "start": 4696, - "end": 4737, + "start": 4701, + "end": 4742, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4696, - "end": 4709, + "start": 4701, + "end": 4714, "ctxt": 0 }, "value": "ensureNotNull", @@ -6892,15 +6892,15 @@ "expression": { "type": "CallExpression", "span": { - "start": 4710, - "end": 4736, + "start": 4715, + "end": 4741, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4710, - "end": 4733, + "start": 4715, + "end": 4738, "ctxt": 0 }, "value": "possiblyNullOrUndefined", @@ -6912,8 +6912,8 @@ "expression": { "type": "Identifier", "span": { - "start": 4734, - "end": 4735, + "start": 4739, + "end": 4740, "ctxt": 0 }, "value": "a", @@ -6934,8 +6934,8 @@ { "type": "VariableDeclaration", "span": { - "start": 4766, - "end": 4822, + "start": 4771, + "end": 4827, "ctxt": 0 }, "kind": "let", @@ -6944,15 +6944,15 @@ { "type": "VariableDeclarator", "span": { - "start": 4770, - "end": 4821, + "start": 4775, + "end": 4826, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 4770, - "end": 4772, + "start": 4775, + "end": 4777, "ctxt": 0 }, "value": "a7", @@ -6962,15 +6962,15 @@ "init": { "type": "CallExpression", "span": { - "start": 4775, - "end": 4821, + "start": 4780, + "end": 4826, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4775, - "end": 4793, + "start": 4780, + "end": 4798, "ctxt": 0 }, "value": "ensureNotUndefined", @@ -6982,15 +6982,15 @@ "expression": { "type": "CallExpression", "span": { - "start": 4794, - "end": 4820, + "start": 4799, + "end": 4825, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4794, - "end": 4817, + "start": 4799, + "end": 4822, "ctxt": 0 }, "value": "possiblyNullOrUndefined", @@ -7002,8 +7002,8 @@ "expression": { "type": "Identifier", "span": { - "start": 4818, - "end": 4819, + "start": 4823, + "end": 4824, "ctxt": 0 }, "value": "a", @@ -7024,8 +7024,8 @@ { "type": "VariableDeclaration", "span": { - "start": 4845, - "end": 4890, + "start": 4850, + "end": 4895, "ctxt": 0 }, "kind": "let", @@ -7034,15 +7034,15 @@ { "type": "VariableDeclarator", "span": { - "start": 4849, - "end": 4889, + "start": 4854, + "end": 4894, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 4849, - "end": 4851, + "start": 4854, + "end": 4856, "ctxt": 0 }, "value": "a8", @@ -7052,15 +7052,15 @@ "init": { "type": "CallExpression", "span": { - "start": 4854, - "end": 4889, + "start": 4859, + "end": 4894, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4854, - "end": 4867, + "start": 4859, + "end": 4872, "ctxt": 0 }, "value": "ensureNotNull", @@ -7072,15 +7072,15 @@ "expression": { "type": "CallExpression", "span": { - "start": 4868, - "end": 4888, + "start": 4873, + "end": 4893, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4868, - "end": 4885, + "start": 4873, + "end": 4890, "ctxt": 0 }, "value": "possiblyUndefined", @@ -7092,8 +7092,8 @@ "expression": { "type": "Identifier", "span": { - "start": 4886, - "end": 4887, + "start": 4891, + "end": 4892, "ctxt": 0 }, "value": "a", @@ -7114,8 +7114,8 @@ { "type": "VariableDeclaration", "span": { - "start": 4918, - "end": 4963, + "start": 4923, + "end": 4968, "ctxt": 0 }, "kind": "let", @@ -7124,15 +7124,15 @@ { "type": "VariableDeclarator", "span": { - "start": 4922, - "end": 4962, + "start": 4927, + "end": 4967, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 4922, - "end": 4924, + "start": 4927, + "end": 4929, "ctxt": 0 }, "value": "a9", @@ -7142,15 +7142,15 @@ "init": { "type": "CallExpression", "span": { - "start": 4927, - "end": 4962, + "start": 4932, + "end": 4967, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4927, - "end": 4945, + "start": 4932, + "end": 4950, "ctxt": 0 }, "value": "ensureNotUndefined", @@ -7162,15 +7162,15 @@ "expression": { "type": "CallExpression", "span": { - "start": 4946, - "end": 4961, + "start": 4951, + "end": 4966, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 4946, - "end": 4958, + "start": 4951, + "end": 4963, "ctxt": 0 }, "value": "possiblyNull", @@ -7182,8 +7182,8 @@ "expression": { "type": "Identifier", "span": { - "start": 4959, - "end": 4960, + "start": 4964, + "end": 4965, "ctxt": 0 }, "value": "a", @@ -7208,23 +7208,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 4317, - "end": 4320, + "start": 4322, + "end": 4325, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 4318, - "end": 4319, + "start": 4323, + "end": 4324, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 4318, - "end": 4319, + "start": 4323, + "end": 4324, "ctxt": 0 }, "value": "T", @@ -7245,8 +7245,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 5016, - "end": 5026, + "start": 5021, + "end": 5031, "ctxt": 0 }, "value": "deepEquals", @@ -7257,16 +7257,16 @@ { "type": "Parameter", "span": { - "start": 5030, - "end": 5034, + "start": 5035, + "end": 5039, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 5030, - "end": 5034, + "start": 5035, + "end": 5039, "ctxt": 0 }, "value": "a", @@ -7274,22 +7274,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 5031, - "end": 5034, + "start": 5036, + "end": 5039, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 5033, - "end": 5034, + "start": 5038, + "end": 5039, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 5033, - "end": 5034, + "start": 5038, + "end": 5039, "ctxt": 0 }, "value": "T", @@ -7303,16 +7303,16 @@ { "type": "Parameter", "span": { - "start": 5036, - "end": 5040, + "start": 5041, + "end": 5045, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 5036, - "end": 5040, + "start": 5041, + "end": 5045, "ctxt": 0 }, "value": "b", @@ -7320,22 +7320,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 5037, - "end": 5040, + "start": 5042, + "end": 5045, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 5039, - "end": 5040, + "start": 5044, + "end": 5045, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 5039, - "end": 5040, + "start": 5044, + "end": 5045, "ctxt": 0 }, "value": "T", @@ -7349,70 +7349,70 @@ ], "decorators": [], "span": { - "start": 5007, - "end": 5346, + "start": 5012, + "end": 5351, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 5051, - "end": 5346, + "start": 5056, + "end": 5351, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 5057, - "end": 5150, + "start": 5062, + "end": 5155, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 5061, - "end": 5119, + "start": 5066, + "end": 5124, "ctxt": 0 }, "operator": "||", "left": { "type": "BinaryExpression", "span": { - "start": 5061, - "end": 5113, + "start": 5066, + "end": 5118, "ctxt": 0 }, "operator": "||", "left": { "type": "BinaryExpression", "span": { - "start": 5061, - "end": 5107, + "start": 5066, + "end": 5112, "ctxt": 0 }, "operator": "||", "left": { "type": "BinaryExpression", "span": { - "start": 5061, - "end": 5082, + "start": 5066, + "end": 5087, "ctxt": 0 }, "operator": "!==", "left": { "type": "UnaryExpression", "span": { - "start": 5061, - "end": 5069, + "start": 5066, + "end": 5074, "ctxt": 0 }, "operator": "typeof", "argument": { "type": "Identifier", "span": { - "start": 5068, - "end": 5069, + "start": 5073, + "end": 5074, "ctxt": 0 }, "value": "a", @@ -7422,8 +7422,8 @@ "right": { "type": "StringLiteral", "span": { - "start": 5074, - "end": 5082, + "start": 5079, + "end": 5087, "ctxt": 0 }, "value": "object", @@ -7433,24 +7433,24 @@ "right": { "type": "BinaryExpression", "span": { - "start": 5086, - "end": 5107, + "start": 5091, + "end": 5112, "ctxt": 0 }, "operator": "!==", "left": { "type": "UnaryExpression", "span": { - "start": 5086, - "end": 5094, + "start": 5091, + "end": 5099, "ctxt": 0 }, "operator": "typeof", "argument": { "type": "Identifier", "span": { - "start": 5093, - "end": 5094, + "start": 5098, + "end": 5099, "ctxt": 0 }, "value": "b", @@ -7460,8 +7460,8 @@ "right": { "type": "StringLiteral", "span": { - "start": 5099, - "end": 5107, + "start": 5104, + "end": 5112, "ctxt": 0 }, "value": "object", @@ -7472,16 +7472,16 @@ "right": { "type": "UnaryExpression", "span": { - "start": 5111, - "end": 5113, + "start": 5116, + "end": 5118, "ctxt": 0 }, "operator": "!", "argument": { "type": "Identifier", "span": { - "start": 5112, - "end": 5113, + "start": 5117, + "end": 5118, "ctxt": 0 }, "value": "a", @@ -7492,16 +7492,16 @@ "right": { "type": "UnaryExpression", "span": { - "start": 5117, - "end": 5119, + "start": 5122, + "end": 5124, "ctxt": 0 }, "operator": "!", "argument": { "type": "Identifier", "span": { - "start": 5118, - "end": 5119, + "start": 5123, + "end": 5124, "ctxt": 0 }, "value": "b", @@ -7512,23 +7512,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 5121, - "end": 5150, + "start": 5126, + "end": 5155, "ctxt": 0 }, "stmts": [ { "type": "ReturnStatement", "span": { - "start": 5131, - "end": 5144, + "start": 5136, + "end": 5149, "ctxt": 0 }, "argument": { "type": "BooleanLiteral", "span": { - "start": 5138, - "end": 5143, + "start": 5143, + "end": 5148, "ctxt": 0 }, "value": false @@ -7541,37 +7541,37 @@ { "type": "IfStatement", "span": { - "start": 5155, - "end": 5226, + "start": 5160, + "end": 5231, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 5159, - "end": 5195, + "start": 5164, + "end": 5200, "ctxt": 0 }, "operator": "||", "left": { "type": "CallExpression", "span": { - "start": 5159, - "end": 5175, + "start": 5164, + "end": 5180, "ctxt": 0 }, "callee": { "type": "MemberExpression", "span": { - "start": 5159, - "end": 5172, + "start": 5164, + "end": 5177, "ctxt": 0 }, "object": { "type": "Identifier", "span": { - "start": 5159, - "end": 5164, + "start": 5164, + "end": 5169, "ctxt": 0 }, "value": "Array", @@ -7580,8 +7580,8 @@ "property": { "type": "Identifier", "span": { - "start": 5165, - "end": 5172, + "start": 5170, + "end": 5177, "ctxt": 0 }, "value": "isArray", @@ -7594,8 +7594,8 @@ "expression": { "type": "Identifier", "span": { - "start": 5173, - "end": 5174, + "start": 5178, + "end": 5179, "ctxt": 0 }, "value": "a", @@ -7608,22 +7608,22 @@ "right": { "type": "CallExpression", "span": { - "start": 5179, - "end": 5195, + "start": 5184, + "end": 5200, "ctxt": 0 }, "callee": { "type": "MemberExpression", "span": { - "start": 5179, - "end": 5192, + "start": 5184, + "end": 5197, "ctxt": 0 }, "object": { "type": "Identifier", "span": { - "start": 5179, - "end": 5184, + "start": 5184, + "end": 5189, "ctxt": 0 }, "value": "Array", @@ -7632,8 +7632,8 @@ "property": { "type": "Identifier", "span": { - "start": 5185, - "end": 5192, + "start": 5190, + "end": 5197, "ctxt": 0 }, "value": "isArray", @@ -7646,8 +7646,8 @@ "expression": { "type": "Identifier", "span": { - "start": 5193, - "end": 5194, + "start": 5198, + "end": 5199, "ctxt": 0 }, "value": "b", @@ -7661,23 +7661,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 5197, - "end": 5226, + "start": 5202, + "end": 5231, "ctxt": 0 }, "stmts": [ { "type": "ReturnStatement", "span": { - "start": 5207, - "end": 5220, + "start": 5212, + "end": 5225, "ctxt": 0 }, "argument": { "type": "BooleanLiteral", "span": { - "start": 5214, - "end": 5219, + "start": 5219, + "end": 5224, "ctxt": 0 }, "value": false @@ -7690,44 +7690,44 @@ { "type": "IfStatement", "span": { - "start": 5231, - "end": 5327, + "start": 5236, + "end": 5332, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 5235, - "end": 5282, + "start": 5240, + "end": 5287, "ctxt": 0 }, "operator": "!==", "left": { "type": "MemberExpression", "span": { - "start": 5235, - "end": 5256, + "start": 5240, + "end": 5261, "ctxt": 0 }, "object": { "type": "CallExpression", "span": { - "start": 5235, - "end": 5249, + "start": 5240, + "end": 5254, "ctxt": 0 }, "callee": { "type": "MemberExpression", "span": { - "start": 5235, - "end": 5246, + "start": 5240, + "end": 5251, "ctxt": 0 }, "object": { "type": "Identifier", "span": { - "start": 5235, - "end": 5241, + "start": 5240, + "end": 5246, "ctxt": 0 }, "value": "Object", @@ -7736,8 +7736,8 @@ "property": { "type": "Identifier", "span": { - "start": 5242, - "end": 5246, + "start": 5247, + "end": 5251, "ctxt": 0 }, "value": "keys", @@ -7750,8 +7750,8 @@ "expression": { "type": "Identifier", "span": { - "start": 5247, - "end": 5248, + "start": 5252, + "end": 5253, "ctxt": 0 }, "value": "a", @@ -7764,8 +7764,8 @@ "property": { "type": "Identifier", "span": { - "start": 5250, - "end": 5256, + "start": 5255, + "end": 5261, "ctxt": 0 }, "value": "length", @@ -7775,29 +7775,29 @@ "right": { "type": "MemberExpression", "span": { - "start": 5261, - "end": 5282, + "start": 5266, + "end": 5287, "ctxt": 0 }, "object": { "type": "CallExpression", "span": { - "start": 5261, - "end": 5275, + "start": 5266, + "end": 5280, "ctxt": 0 }, "callee": { "type": "MemberExpression", "span": { - "start": 5261, - "end": 5272, + "start": 5266, + "end": 5277, "ctxt": 0 }, "object": { "type": "Identifier", "span": { - "start": 5261, - "end": 5267, + "start": 5266, + "end": 5272, "ctxt": 0 }, "value": "Object", @@ -7806,8 +7806,8 @@ "property": { "type": "Identifier", "span": { - "start": 5268, - "end": 5272, + "start": 5273, + "end": 5277, "ctxt": 0 }, "value": "keys", @@ -7820,8 +7820,8 @@ "expression": { "type": "Identifier", "span": { - "start": 5273, - "end": 5274, + "start": 5278, + "end": 5279, "ctxt": 0 }, "value": "b", @@ -7834,8 +7834,8 @@ "property": { "type": "Identifier", "span": { - "start": 5276, - "end": 5282, + "start": 5281, + "end": 5287, "ctxt": 0 }, "value": "length", @@ -7846,23 +7846,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 5284, - "end": 5327, + "start": 5289, + "end": 5332, "ctxt": 0 }, "stmts": [ { "type": "ReturnStatement", "span": { - "start": 5308, - "end": 5321, + "start": 5313, + "end": 5326, "ctxt": 0 }, "argument": { "type": "BooleanLiteral", "span": { - "start": 5315, - "end": 5320, + "start": 5320, + "end": 5325, "ctxt": 0 }, "value": false @@ -7875,15 +7875,15 @@ { "type": "ReturnStatement", "span": { - "start": 5332, - "end": 5344, + "start": 5337, + "end": 5349, "ctxt": 0 }, "argument": { "type": "BooleanLiteral", "span": { - "start": 5339, - "end": 5343, + "start": 5344, + "end": 5348, "ctxt": 0 }, "value": true @@ -7896,23 +7896,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 5026, - "end": 5029, + "start": 5031, + "end": 5034, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 5027, - "end": 5028, + "start": 5032, + "end": 5033, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 5027, - "end": 5028, + "start": 5032, + "end": 5033, "ctxt": 0 }, "value": "T", @@ -7929,15 +7929,15 @@ "returnType": { "type": "TsTypeAnnotation", "span": { - "start": 5041, - "end": 5050, + "start": 5046, + "end": 5055, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 5043, - "end": 5050, + "start": 5048, + "end": 5055, "ctxt": 0 }, "kind": "boolean" @@ -7949,8 +7949,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 5379, - "end": 5382, + "start": 5384, + "end": 5387, "ctxt": 0 }, "value": "foo", @@ -7961,16 +7961,16 @@ { "type": "Parameter", "span": { - "start": 5386, - "end": 5397, + "start": 5391, + "end": 5402, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 5386, - "end": 5397, + "start": 5391, + "end": 5402, "ctxt": 0 }, "value": "x", @@ -7978,30 +7978,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 5387, - "end": 5397, + "start": 5392, + "end": 5402, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 5389, - "end": 5397, + "start": 5394, + "end": 5402, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 5389, - "end": 5390, + "start": 5394, + "end": 5395, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 5389, - "end": 5390, + "start": 5394, + "end": 5395, "ctxt": 0 }, "value": "T", @@ -8012,8 +8012,8 @@ { "type": "TsKeywordType", "span": { - "start": 5393, - "end": 5397, + "start": 5398, + "end": 5402, "ctxt": 0 }, "kind": "null" @@ -8026,23 +8026,23 @@ ], "decorators": [], "span": { - "start": 5370, - "end": 5456, + "start": 5375, + "end": 5461, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 5399, - "end": 5456, + "start": 5404, + "end": 5461, "ctxt": 0 }, "stmts": [ { "type": "VariableDeclaration", "span": { - "start": 5405, - "end": 5415, + "start": 5410, + "end": 5420, "ctxt": 0 }, "kind": "let", @@ -8051,15 +8051,15 @@ { "type": "VariableDeclarator", "span": { - "start": 5409, - "end": 5414, + "start": 5414, + "end": 5419, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 5409, - "end": 5410, + "start": 5414, + "end": 5415, "ctxt": 0 }, "value": "y", @@ -8069,8 +8069,8 @@ "init": { "type": "Identifier", "span": { - "start": 5413, - "end": 5414, + "start": 5418, + "end": 5419, "ctxt": 0 }, "value": "x", @@ -8083,23 +8083,23 @@ { "type": "IfStatement", "span": { - "start": 5420, - "end": 5454, + "start": 5425, + "end": 5459, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 5424, - "end": 5434, + "start": 5429, + "end": 5439, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 5424, - "end": 5425, + "start": 5429, + "end": 5430, "ctxt": 0 }, "value": "y", @@ -8108,8 +8108,8 @@ "right": { "type": "NullLiteral", "span": { - "start": 5430, - "end": 5434, + "start": 5435, + "end": 5439, "ctxt": 0 } } @@ -8117,23 +8117,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 5436, - "end": 5454, + "start": 5441, + "end": 5459, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 5446, - "end": 5448, + "start": 5451, + "end": 5453, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 5446, - "end": 5447, + "start": 5451, + "end": 5452, "ctxt": 0 }, "value": "y", @@ -8151,23 +8151,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 5382, - "end": 5385, + "start": 5387, + "end": 5390, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 5383, - "end": 5384, + "start": 5388, + "end": 5389, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 5383, - "end": 5384, + "start": 5388, + "end": 5389, "ctxt": 0 }, "value": "T", @@ -8188,8 +8188,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 5754, - "end": 5757, + "start": 5759, + "end": 5762, "ctxt": 0 }, "value": "ff1", @@ -8200,16 +8200,16 @@ { "type": "Parameter", "span": { - "start": 5761, - "end": 5765, + "start": 5766, + "end": 5770, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 5761, - "end": 5765, + "start": 5766, + "end": 5770, "ctxt": 0 }, "value": "t", @@ -8217,22 +8217,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 5762, - "end": 5765, + "start": 5767, + "end": 5770, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 5764, - "end": 5765, + "start": 5769, + "end": 5770, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 5764, - "end": 5765, + "start": 5769, + "end": 5770, "ctxt": 0 }, "value": "T", @@ -8246,16 +8246,16 @@ { "type": "Parameter", "span": { - "start": 5767, - "end": 5777, + "start": 5772, + "end": 5782, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 5767, - "end": 5777, + "start": 5772, + "end": 5782, "ctxt": 0 }, "value": "k", @@ -8263,30 +8263,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 5768, - "end": 5777, + "start": 5773, + "end": 5782, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeOperator", "span": { - "start": 5770, - "end": 5777, + "start": 5775, + "end": 5782, "ctxt": 0 }, "op": "keyof", "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 5776, - "end": 5777, + "start": 5781, + "end": 5782, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 5776, - "end": 5777, + "start": 5781, + "end": 5782, "ctxt": 0 }, "value": "T", @@ -8301,37 +8301,37 @@ ], "decorators": [], "span": { - "start": 5745, - "end": 5792, + "start": 5750, + "end": 5797, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 5779, - "end": 5792, + "start": 5784, + "end": 5797, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 5785, - "end": 5790, + "start": 5790, + "end": 5795, "ctxt": 0 }, "expression": { "type": "MemberExpression", "span": { - "start": 5785, - "end": 5789, + "start": 5790, + "end": 5794, "ctxt": 0 }, "object": { "type": "Identifier", "span": { - "start": 5785, - "end": 5786, + "start": 5790, + "end": 5791, "ctxt": 0 }, "value": "t", @@ -8340,15 +8340,15 @@ "property": { "type": "Computed", "span": { - "start": 5786, - "end": 5789, + "start": 5791, + "end": 5794, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 5787, - "end": 5788, + "start": 5792, + "end": 5793, "ctxt": 0 }, "value": "k", @@ -8364,23 +8364,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 5757, - "end": 5760, + "start": 5762, + "end": 5765, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 5758, - "end": 5759, + "start": 5763, + "end": 5764, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 5758, - "end": 5759, + "start": 5763, + "end": 5764, "ctxt": 0 }, "value": "T", @@ -8401,8 +8401,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 5803, - "end": 5806, + "start": 5808, + "end": 5811, "ctxt": 0 }, "value": "ff2", @@ -8413,16 +8413,16 @@ { "type": "Parameter", "span": { - "start": 5810, - "end": 5819, + "start": 5815, + "end": 5824, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 5810, - "end": 5819, + "start": 5815, + "end": 5824, "ctxt": 0 }, "value": "t", @@ -8430,30 +8430,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 5811, - "end": 5819, + "start": 5816, + "end": 5824, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 5813, - "end": 5819, + "start": 5818, + "end": 5824, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 5813, - "end": 5814, + "start": 5818, + "end": 5819, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 5813, - "end": 5814, + "start": 5818, + "end": 5819, "ctxt": 0 }, "value": "T", @@ -8464,8 +8464,8 @@ { "type": "TsTypeLiteral", "span": { - "start": 5817, - "end": 5819, + "start": 5822, + "end": 5824, "ctxt": 0 }, "members": [] @@ -8478,16 +8478,16 @@ { "type": "Parameter", "span": { - "start": 5821, - "end": 5831, + "start": 5826, + "end": 5836, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 5821, - "end": 5831, + "start": 5826, + "end": 5836, "ctxt": 0 }, "value": "k", @@ -8495,30 +8495,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 5822, - "end": 5831, + "start": 5827, + "end": 5836, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeOperator", "span": { - "start": 5824, - "end": 5831, + "start": 5829, + "end": 5836, "ctxt": 0 }, "op": "keyof", "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 5830, - "end": 5831, + "start": 5835, + "end": 5836, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 5830, - "end": 5831, + "start": 5835, + "end": 5836, "ctxt": 0 }, "value": "T", @@ -8533,37 +8533,37 @@ ], "decorators": [], "span": { - "start": 5794, - "end": 5846, + "start": 5799, + "end": 5851, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 5833, - "end": 5846, + "start": 5838, + "end": 5851, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 5839, - "end": 5844, + "start": 5844, + "end": 5849, "ctxt": 0 }, "expression": { "type": "MemberExpression", "span": { - "start": 5839, - "end": 5843, + "start": 5844, + "end": 5848, "ctxt": 0 }, "object": { "type": "Identifier", "span": { - "start": 5839, - "end": 5840, + "start": 5844, + "end": 5845, "ctxt": 0 }, "value": "t", @@ -8572,15 +8572,15 @@ "property": { "type": "Computed", "span": { - "start": 5840, - "end": 5843, + "start": 5845, + "end": 5848, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 5841, - "end": 5842, + "start": 5846, + "end": 5847, "ctxt": 0 }, "value": "k", @@ -8596,23 +8596,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 5806, - "end": 5809, + "start": 5811, + "end": 5814, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 5807, - "end": 5808, + "start": 5812, + "end": 5813, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 5807, - "end": 5808, + "start": 5812, + "end": 5813, "ctxt": 0 }, "value": "T", @@ -8633,8 +8633,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 5857, - "end": 5860, + "start": 5862, + "end": 5865, "ctxt": 0 }, "value": "ff3", @@ -8645,16 +8645,16 @@ { "type": "Parameter", "span": { - "start": 5864, - "end": 5868, + "start": 5869, + "end": 5873, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 5864, - "end": 5868, + "start": 5869, + "end": 5873, "ctxt": 0 }, "value": "t", @@ -8662,22 +8662,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 5865, - "end": 5868, + "start": 5870, + "end": 5873, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 5867, - "end": 5868, + "start": 5872, + "end": 5873, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 5867, - "end": 5868, + "start": 5872, + "end": 5873, "ctxt": 0 }, "value": "T", @@ -8691,16 +8691,16 @@ { "type": "Parameter", "span": { - "start": 5870, - "end": 5887, + "start": 5875, + "end": 5892, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 5870, - "end": 5887, + "start": 5875, + "end": 5892, "ctxt": 0 }, "value": "k", @@ -8708,45 +8708,45 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 5871, - "end": 5887, + "start": 5876, + "end": 5892, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeOperator", "span": { - "start": 5873, - "end": 5887, + "start": 5878, + "end": 5892, "ctxt": 0 }, "op": "keyof", "typeAnnotation": { "type": "TsParenthesizedType", "span": { - "start": 5879, - "end": 5887, + "start": 5884, + "end": 5892, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 5880, - "end": 5886, + "start": 5885, + "end": 5891, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 5880, - "end": 5881, + "start": 5885, + "end": 5886, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 5880, - "end": 5881, + "start": 5885, + "end": 5886, "ctxt": 0 }, "value": "T", @@ -8757,8 +8757,8 @@ { "type": "TsTypeLiteral", "span": { - "start": 5884, - "end": 5886, + "start": 5889, + "end": 5891, "ctxt": 0 }, "members": [] @@ -8773,37 +8773,37 @@ ], "decorators": [], "span": { - "start": 5848, - "end": 5912, + "start": 5853, + "end": 5917, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 5889, - "end": 5912, + "start": 5894, + "end": 5917, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 5895, - "end": 5900, + "start": 5900, + "end": 5905, "ctxt": 0 }, "expression": { "type": "MemberExpression", "span": { - "start": 5895, - "end": 5899, + "start": 5900, + "end": 5904, "ctxt": 0 }, "object": { "type": "Identifier", "span": { - "start": 5895, - "end": 5896, + "start": 5900, + "end": 5901, "ctxt": 0 }, "value": "t", @@ -8812,15 +8812,15 @@ "property": { "type": "Computed", "span": { - "start": 5896, - "end": 5899, + "start": 5901, + "end": 5904, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 5897, - "end": 5898, + "start": 5902, + "end": 5903, "ctxt": 0 }, "value": "k", @@ -8836,23 +8836,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 5860, - "end": 5863, + "start": 5865, + "end": 5868, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 5861, - "end": 5862, + "start": 5866, + "end": 5867, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 5861, - "end": 5862, + "start": 5866, + "end": 5867, "ctxt": 0 }, "value": "T", @@ -8873,8 +8873,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 5923, - "end": 5926, + "start": 5928, + "end": 5931, "ctxt": 0 }, "value": "ff4", @@ -8885,16 +8885,16 @@ { "type": "Parameter", "span": { - "start": 5930, - "end": 5939, + "start": 5935, + "end": 5944, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 5930, - "end": 5939, + "start": 5935, + "end": 5944, "ctxt": 0 }, "value": "t", @@ -8902,30 +8902,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 5931, - "end": 5939, + "start": 5936, + "end": 5944, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 5933, - "end": 5939, + "start": 5938, + "end": 5944, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 5933, - "end": 5934, + "start": 5938, + "end": 5939, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 5933, - "end": 5934, + "start": 5938, + "end": 5939, "ctxt": 0 }, "value": "T", @@ -8936,8 +8936,8 @@ { "type": "TsTypeLiteral", "span": { - "start": 5937, - "end": 5939, + "start": 5942, + "end": 5944, "ctxt": 0 }, "members": [] @@ -8950,16 +8950,16 @@ { "type": "Parameter", "span": { - "start": 5941, - "end": 5958, + "start": 5946, + "end": 5963, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 5941, - "end": 5958, + "start": 5946, + "end": 5963, "ctxt": 0 }, "value": "k", @@ -8967,45 +8967,45 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 5942, - "end": 5958, + "start": 5947, + "end": 5963, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeOperator", "span": { - "start": 5944, - "end": 5958, + "start": 5949, + "end": 5963, "ctxt": 0 }, "op": "keyof", "typeAnnotation": { "type": "TsParenthesizedType", "span": { - "start": 5950, - "end": 5958, + "start": 5955, + "end": 5963, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 5951, - "end": 5957, + "start": 5956, + "end": 5962, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 5951, - "end": 5952, + "start": 5956, + "end": 5957, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 5951, - "end": 5952, + "start": 5956, + "end": 5957, "ctxt": 0 }, "value": "T", @@ -9016,8 +9016,8 @@ { "type": "TsTypeLiteral", "span": { - "start": 5955, - "end": 5957, + "start": 5960, + "end": 5962, "ctxt": 0 }, "members": [] @@ -9032,37 +9032,37 @@ ], "decorators": [], "span": { - "start": 5914, - "end": 5973, + "start": 5919, + "end": 5978, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 5960, - "end": 5973, + "start": 5965, + "end": 5978, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 5966, - "end": 5971, + "start": 5971, + "end": 5976, "ctxt": 0 }, "expression": { "type": "MemberExpression", "span": { - "start": 5966, - "end": 5970, + "start": 5971, + "end": 5975, "ctxt": 0 }, "object": { "type": "Identifier", "span": { - "start": 5966, - "end": 5967, + "start": 5971, + "end": 5972, "ctxt": 0 }, "value": "t", @@ -9071,15 +9071,15 @@ "property": { "type": "Computed", "span": { - "start": 5967, - "end": 5970, + "start": 5972, + "end": 5975, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 5968, - "end": 5969, + "start": 5973, + "end": 5974, "ctxt": 0 }, "value": "k", @@ -9095,23 +9095,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 5926, - "end": 5929, + "start": 5931, + "end": 5934, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 5927, - "end": 5928, + "start": 5932, + "end": 5933, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 5927, - "end": 5928, + "start": 5932, + "end": 5933, "ctxt": 0 }, "value": "T", @@ -9130,22 +9130,22 @@ { "type": "ExpressionStatement", "span": { - "start": 5975, - "end": 5992, + "start": 5980, + "end": 5997, "ctxt": 0 }, "expression": { "type": "CallExpression", "span": { - "start": 5975, - "end": 5991, + "start": 5980, + "end": 5996, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 5975, - "end": 5978, + "start": 5980, + "end": 5983, "ctxt": 0 }, "value": "ff1", @@ -9157,8 +9157,8 @@ "expression": { "type": "NullLiteral", "span": { - "start": 5979, - "end": 5983, + "start": 5984, + "end": 5988, "ctxt": 0 } } @@ -9168,8 +9168,8 @@ "expression": { "type": "StringLiteral", "span": { - "start": 5985, - "end": 5990, + "start": 5990, + "end": 5995, "ctxt": 0 }, "value": "foo", @@ -9183,22 +9183,22 @@ { "type": "ExpressionStatement", "span": { - "start": 6003, - "end": 6020, + "start": 6008, + "end": 6025, "ctxt": 0 }, "expression": { "type": "CallExpression", "span": { - "start": 6003, - "end": 6019, + "start": 6008, + "end": 6024, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 6003, - "end": 6006, + "start": 6008, + "end": 6011, "ctxt": 0 }, "value": "ff2", @@ -9210,8 +9210,8 @@ "expression": { "type": "NullLiteral", "span": { - "start": 6007, - "end": 6011, + "start": 6012, + "end": 6016, "ctxt": 0 } } @@ -9221,8 +9221,8 @@ "expression": { "type": "StringLiteral", "span": { - "start": 6013, - "end": 6018, + "start": 6018, + "end": 6023, "ctxt": 0 }, "value": "foo", @@ -9236,22 +9236,22 @@ { "type": "ExpressionStatement", "span": { - "start": 6031, - "end": 6048, + "start": 6036, + "end": 6053, "ctxt": 0 }, "expression": { "type": "CallExpression", "span": { - "start": 6031, - "end": 6047, + "start": 6036, + "end": 6052, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 6031, - "end": 6034, + "start": 6036, + "end": 6039, "ctxt": 0 }, "value": "ff3", @@ -9263,8 +9263,8 @@ "expression": { "type": "NullLiteral", "span": { - "start": 6035, - "end": 6039, + "start": 6040, + "end": 6044, "ctxt": 0 } } @@ -9274,8 +9274,8 @@ "expression": { "type": "StringLiteral", "span": { - "start": 6041, - "end": 6046, + "start": 6046, + "end": 6051, "ctxt": 0 }, "value": "foo", @@ -9289,22 +9289,22 @@ { "type": "ExpressionStatement", "span": { - "start": 6049, - "end": 6066, + "start": 6054, + "end": 6071, "ctxt": 0 }, "expression": { "type": "CallExpression", "span": { - "start": 6049, - "end": 6065, + "start": 6054, + "end": 6070, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 6049, - "end": 6052, + "start": 6054, + "end": 6057, "ctxt": 0 }, "value": "ff4", @@ -9316,8 +9316,8 @@ "expression": { "type": "NullLiteral", "span": { - "start": 6053, - "end": 6057, + "start": 6058, + "end": 6062, "ctxt": 0 } } @@ -9327,8 +9327,8 @@ "expression": { "type": "StringLiteral", "span": { - "start": 6059, - "end": 6064, + "start": 6064, + "end": 6069, "ctxt": 0 }, "value": "foo", @@ -9342,16 +9342,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 6100, - "end": 6138, + "start": 6105, + "end": 6143, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 6105, - "end": 6108, + "start": 6110, + "end": 6113, "ctxt": 0 }, "value": "Foo", @@ -9361,8 +9361,8 @@ "typeAnnotation": { "type": "TsTypeLiteral", "span": { - "start": 6111, - "end": 6137, + "start": 6116, + "end": 6142, "ctxt": 0 }, "members": [ @@ -9372,8 +9372,8 @@ { "type": "Identifier", "span": { - "start": 6114, - "end": 6125, + "start": 6119, + "end": 6130, "ctxt": 0 }, "value": "key", @@ -9381,15 +9381,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 6117, - "end": 6125, + "start": 6122, + "end": 6130, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 6119, - "end": 6125, + "start": 6124, + "end": 6130, "ctxt": 0 }, "kind": "string" @@ -9400,15 +9400,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 6126, - "end": 6135, + "start": 6131, + "end": 6140, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 6128, - "end": 6135, + "start": 6133, + "end": 6140, "ctxt": 0 }, "kind": "unknown" @@ -9417,8 +9417,8 @@ "readonly": false, "static": false, "span": { - "start": 6113, - "end": 6135, + "start": 6118, + "end": 6140, "ctxt": 0 } } @@ -9428,16 +9428,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 6139, - "end": 6174, + "start": 6144, + "end": 6179, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 6144, - "end": 6155, + "start": 6149, + "end": 6160, "ctxt": 0 }, "value": "NullableFoo", @@ -9447,23 +9447,23 @@ "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 6158, - "end": 6173, + "start": 6163, + "end": 6178, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 6158, - "end": 6161, + "start": 6163, + "end": 6166, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 6158, - "end": 6161, + "start": 6163, + "end": 6166, "ctxt": 0 }, "value": "Foo", @@ -9474,8 +9474,8 @@ { "type": "TsKeywordType", "span": { - "start": 6164, - "end": 6173, + "start": 6169, + "end": 6178, "ctxt": 0 }, "kind": "undefined" @@ -9486,16 +9486,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 6176, - "end": 6233, + "start": 6181, + "end": 6238, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 6181, - "end": 6184, + "start": 6186, + "end": 6189, "ctxt": 0 }, "value": "Bar", @@ -9504,23 +9504,23 @@ "typeParams": { "type": "TsTypeParameterDeclaration", "span": { - "start": 6184, - "end": 6207, + "start": 6189, + "end": 6212, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 6185, - "end": 6206, + "start": 6190, + "end": 6211, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 6185, - "end": 6186, + "start": 6190, + "end": 6191, "ctxt": 0 }, "value": "T", @@ -9532,15 +9532,15 @@ "constraint": { "type": "TsTypeReference", "span": { - "start": 6195, - "end": 6206, + "start": 6200, + "end": 6211, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 6195, - "end": 6206, + "start": 6200, + "end": 6211, "ctxt": 0 }, "value": "NullableFoo", @@ -9555,23 +9555,23 @@ "typeAnnotation": { "type": "TsIndexedAccessType", "span": { - "start": 6210, - "end": 6232, + "start": 6215, + "end": 6237, "ctxt": 0 }, "readonly": false, "objectType": { "type": "TsTypeReference", "span": { - "start": 6210, - "end": 6224, + "start": 6215, + "end": 6229, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 6210, - "end": 6221, + "start": 6215, + "end": 6226, "ctxt": 0 }, "value": "NonNullable", @@ -9580,23 +9580,23 @@ "typeParams": { "type": "TsTypeParameterInstantiation", "span": { - "start": 6221, - "end": 6224, + "start": 6226, + "end": 6229, "ctxt": 0 }, "params": [ { "type": "TsTypeReference", "span": { - "start": 6222, - "end": 6223, + "start": 6227, + "end": 6228, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 6222, - "end": 6223, + "start": 6227, + "end": 6228, "ctxt": 0 }, "value": "T", @@ -9610,8 +9610,8 @@ "indexType": { "type": "TsKeywordType", "span": { - "start": 6225, - "end": 6231, + "start": 6230, + "end": 6236, "ctxt": 0 }, "kind": "string" @@ -9623,8 +9623,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 6283, - "end": 6286, + "start": 6288, + "end": 6291, "ctxt": 0 }, "value": "fx0", @@ -9635,16 +9635,16 @@ { "type": "Parameter", "span": { - "start": 6290, - "end": 6312, + "start": 6295, + "end": 6317, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 6290, - "end": 6312, + "start": 6295, + "end": 6317, "ctxt": 0 }, "value": "value", @@ -9652,30 +9652,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 6295, - "end": 6312, + "start": 6300, + "end": 6317, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 6297, - "end": 6312, + "start": 6302, + "end": 6317, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 6297, - "end": 6298, + "start": 6302, + "end": 6303, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 6297, - "end": 6298, + "start": 6302, + "end": 6303, "ctxt": 0 }, "value": "T", @@ -9686,23 +9686,23 @@ { "type": "TsParenthesizedType", "span": { - "start": 6301, - "end": 6312, + "start": 6306, + "end": 6317, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 6302, - "end": 6311, + "start": 6307, + "end": 6316, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 6302, - "end": 6304, + "start": 6307, + "end": 6309, "ctxt": 0 }, "members": [] @@ -9710,8 +9710,8 @@ { "type": "TsKeywordType", "span": { - "start": 6307, - "end": 6311, + "start": 6312, + "end": 6316, "ctxt": 0 }, "kind": "null" @@ -9727,38 +9727,38 @@ ], "decorators": [], "span": { - "start": 6274, - "end": 6425, + "start": 6279, + "end": 6430, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 6314, - "end": 6425, + "start": 6319, + "end": 6430, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 6320, - "end": 6423, + "start": 6325, + "end": 6428, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 6324, - "end": 6336, + "start": 6329, + "end": 6341, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 6324, - "end": 6329, + "start": 6329, + "end": 6334, "ctxt": 0 }, "value": "value", @@ -9767,8 +9767,8 @@ "right": { "type": "NumericLiteral", "span": { - "start": 6334, - "end": 6336, + "start": 6339, + "end": 6341, "ctxt": 0 }, "value": 42.0, @@ -9778,23 +9778,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 6338, - "end": 6371, + "start": 6343, + "end": 6376, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 6348, - "end": 6354, + "start": 6353, + "end": 6359, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 6348, - "end": 6353, + "start": 6353, + "end": 6358, "ctxt": 0 }, "value": "value", @@ -9806,23 +9806,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 6381, - "end": 6423, + "start": 6386, + "end": 6428, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 6391, - "end": 6397, + "start": 6396, + "end": 6402, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 6391, - "end": 6396, + "start": 6396, + "end": 6401, "ctxt": 0 }, "value": "value", @@ -9839,23 +9839,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 6286, - "end": 6289, + "start": 6291, + "end": 6294, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 6287, - "end": 6288, + "start": 6292, + "end": 6293, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 6287, - "end": 6288, + "start": 6292, + "end": 6293, "ctxt": 0 }, "value": "T", @@ -9876,8 +9876,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 6436, - "end": 6439, + "start": 6441, + "end": 6444, "ctxt": 0 }, "value": "fx1", @@ -9888,16 +9888,16 @@ { "type": "Parameter", "span": { - "start": 6459, - "end": 6481, + "start": 6464, + "end": 6486, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 6459, - "end": 6481, + "start": 6464, + "end": 6486, "ctxt": 0 }, "value": "value", @@ -9905,30 +9905,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 6464, - "end": 6481, + "start": 6469, + "end": 6486, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 6466, - "end": 6481, + "start": 6471, + "end": 6486, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 6466, - "end": 6467, + "start": 6471, + "end": 6472, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 6466, - "end": 6467, + "start": 6471, + "end": 6472, "ctxt": 0 }, "value": "T", @@ -9939,23 +9939,23 @@ { "type": "TsParenthesizedType", "span": { - "start": 6470, - "end": 6481, + "start": 6475, + "end": 6486, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 6471, - "end": 6480, + "start": 6476, + "end": 6485, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 6471, - "end": 6473, + "start": 6476, + "end": 6478, "ctxt": 0 }, "members": [] @@ -9963,8 +9963,8 @@ { "type": "TsKeywordType", "span": { - "start": 6476, - "end": 6480, + "start": 6481, + "end": 6485, "ctxt": 0 }, "kind": "null" @@ -9980,38 +9980,38 @@ ], "decorators": [], "span": { - "start": 6427, - "end": 6594, + "start": 6432, + "end": 6599, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 6483, - "end": 6594, + "start": 6488, + "end": 6599, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 6489, - "end": 6592, + "start": 6494, + "end": 6597, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 6493, - "end": 6505, + "start": 6498, + "end": 6510, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 6493, - "end": 6498, + "start": 6498, + "end": 6503, "ctxt": 0 }, "value": "value", @@ -10020,8 +10020,8 @@ "right": { "type": "NumericLiteral", "span": { - "start": 6503, - "end": 6505, + "start": 6508, + "end": 6510, "ctxt": 0 }, "value": 42.0, @@ -10031,23 +10031,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 6507, - "end": 6540, + "start": 6512, + "end": 6545, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 6517, - "end": 6523, + "start": 6522, + "end": 6528, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 6517, - "end": 6522, + "start": 6522, + "end": 6527, "ctxt": 0 }, "value": "value", @@ -10059,23 +10059,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 6550, - "end": 6592, + "start": 6555, + "end": 6597, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 6560, - "end": 6566, + "start": 6565, + "end": 6571, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 6560, - "end": 6565, + "start": 6565, + "end": 6570, "ctxt": 0 }, "value": "value", @@ -10092,23 +10092,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 6439, - "end": 6458, + "start": 6444, + "end": 6463, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 6440, - "end": 6457, + "start": 6445, + "end": 6462, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 6440, - "end": 6441, + "start": 6445, + "end": 6446, "ctxt": 0 }, "value": "T", @@ -10120,8 +10120,8 @@ "constraint": { "type": "TsKeywordType", "span": { - "start": 6450, - "end": 6457, + "start": 6455, + "end": 6462, "ctxt": 0 }, "kind": "unknown" @@ -10137,8 +10137,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 6605, - "end": 6608, + "start": 6610, + "end": 6613, "ctxt": 0 }, "value": "fx2", @@ -10149,16 +10149,16 @@ { "type": "Parameter", "span": { - "start": 6623, - "end": 6645, + "start": 6628, + "end": 6650, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 6623, - "end": 6645, + "start": 6628, + "end": 6650, "ctxt": 0 }, "value": "value", @@ -10166,30 +10166,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 6628, - "end": 6645, + "start": 6633, + "end": 6650, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 6630, - "end": 6645, + "start": 6635, + "end": 6650, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 6630, - "end": 6631, + "start": 6635, + "end": 6636, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 6630, - "end": 6631, + "start": 6635, + "end": 6636, "ctxt": 0 }, "value": "T", @@ -10200,23 +10200,23 @@ { "type": "TsParenthesizedType", "span": { - "start": 6634, - "end": 6645, + "start": 6639, + "end": 6650, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 6635, - "end": 6644, + "start": 6640, + "end": 6649, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 6635, - "end": 6637, + "start": 6640, + "end": 6642, "ctxt": 0 }, "members": [] @@ -10224,8 +10224,8 @@ { "type": "TsKeywordType", "span": { - "start": 6640, - "end": 6644, + "start": 6645, + "end": 6649, "ctxt": 0 }, "kind": "null" @@ -10241,38 +10241,38 @@ ], "decorators": [], "span": { - "start": 6596, - "end": 6758, + "start": 6601, + "end": 6763, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 6647, - "end": 6758, + "start": 6652, + "end": 6763, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 6653, - "end": 6756, + "start": 6658, + "end": 6761, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 6657, - "end": 6669, + "start": 6662, + "end": 6674, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 6657, - "end": 6662, + "start": 6662, + "end": 6667, "ctxt": 0 }, "value": "value", @@ -10281,8 +10281,8 @@ "right": { "type": "NumericLiteral", "span": { - "start": 6667, - "end": 6669, + "start": 6672, + "end": 6674, "ctxt": 0 }, "value": 42.0, @@ -10292,23 +10292,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 6671, - "end": 6704, + "start": 6676, + "end": 6709, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 6681, - "end": 6687, + "start": 6686, + "end": 6692, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 6681, - "end": 6686, + "start": 6686, + "end": 6691, "ctxt": 0 }, "value": "value", @@ -10320,23 +10320,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 6714, - "end": 6756, + "start": 6719, + "end": 6761, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 6724, - "end": 6730, + "start": 6729, + "end": 6735, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 6724, - "end": 6729, + "start": 6729, + "end": 6734, "ctxt": 0 }, "value": "value", @@ -10353,23 +10353,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 6608, - "end": 6622, + "start": 6613, + "end": 6627, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 6609, - "end": 6621, + "start": 6614, + "end": 6626, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 6609, - "end": 6610, + "start": 6614, + "end": 6615, "ctxt": 0 }, "value": "T", @@ -10381,8 +10381,8 @@ "constraint": { "type": "TsTypeLiteral", "span": { - "start": 6619, - "end": 6621, + "start": 6624, + "end": 6626, "ctxt": 0 }, "members": [] @@ -10398,8 +10398,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 6769, - "end": 6772, + "start": 6774, + "end": 6777, "ctxt": 0 }, "value": "fx3", @@ -10410,16 +10410,16 @@ { "type": "Parameter", "span": { - "start": 6799, - "end": 6821, + "start": 6804, + "end": 6826, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 6799, - "end": 6821, + "start": 6804, + "end": 6826, "ctxt": 0 }, "value": "value", @@ -10427,30 +10427,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 6804, - "end": 6821, + "start": 6809, + "end": 6826, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 6806, - "end": 6821, + "start": 6811, + "end": 6826, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 6806, - "end": 6807, + "start": 6811, + "end": 6812, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 6806, - "end": 6807, + "start": 6811, + "end": 6812, "ctxt": 0 }, "value": "T", @@ -10461,23 +10461,23 @@ { "type": "TsParenthesizedType", "span": { - "start": 6810, - "end": 6821, + "start": 6815, + "end": 6826, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 6811, - "end": 6820, + "start": 6816, + "end": 6825, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 6811, - "end": 6813, + "start": 6816, + "end": 6818, "ctxt": 0 }, "members": [] @@ -10485,8 +10485,8 @@ { "type": "TsKeywordType", "span": { - "start": 6816, - "end": 6820, + "start": 6821, + "end": 6825, "ctxt": 0 }, "kind": "null" @@ -10502,38 +10502,38 @@ ], "decorators": [], "span": { - "start": 6760, - "end": 6934, + "start": 6765, + "end": 6939, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 6823, - "end": 6934, + "start": 6828, + "end": 6939, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 6829, - "end": 6932, + "start": 6834, + "end": 6937, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 6833, - "end": 6845, + "start": 6838, + "end": 6850, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 6833, - "end": 6838, + "start": 6838, + "end": 6843, "ctxt": 0 }, "value": "value", @@ -10542,8 +10542,8 @@ "right": { "type": "NumericLiteral", "span": { - "start": 6843, - "end": 6845, + "start": 6848, + "end": 6850, "ctxt": 0 }, "value": 42.0, @@ -10553,23 +10553,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 6847, - "end": 6880, + "start": 6852, + "end": 6885, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 6857, - "end": 6863, + "start": 6862, + "end": 6868, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 6857, - "end": 6862, + "start": 6862, + "end": 6867, "ctxt": 0 }, "value": "value", @@ -10581,23 +10581,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 6890, - "end": 6932, + "start": 6895, + "end": 6937, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 6900, - "end": 6906, + "start": 6905, + "end": 6911, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 6900, - "end": 6905, + "start": 6905, + "end": 6910, "ctxt": 0 }, "value": "value", @@ -10614,23 +10614,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 6772, - "end": 6798, + "start": 6777, + "end": 6803, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 6773, - "end": 6797, + "start": 6778, + "end": 6802, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 6773, - "end": 6774, + "start": 6778, + "end": 6779, "ctxt": 0 }, "value": "T", @@ -10642,16 +10642,16 @@ "constraint": { "type": "TsUnionType", "span": { - "start": 6783, - "end": 6797, + "start": 6788, + "end": 6802, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 6783, - "end": 6785, + "start": 6788, + "end": 6790, "ctxt": 0 }, "members": [] @@ -10659,8 +10659,8 @@ { "type": "TsKeywordType", "span": { - "start": 6788, - "end": 6797, + "start": 6793, + "end": 6802, "ctxt": 0 }, "kind": "undefined" @@ -10678,8 +10678,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 6945, - "end": 6948, + "start": 6950, + "end": 6953, "ctxt": 0 }, "value": "fx4", @@ -10690,16 +10690,16 @@ { "type": "Parameter", "span": { - "start": 6970, - "end": 6992, + "start": 6975, + "end": 6997, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 6970, - "end": 6992, + "start": 6975, + "end": 6997, "ctxt": 0 }, "value": "value", @@ -10707,30 +10707,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 6975, - "end": 6992, + "start": 6980, + "end": 6997, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 6977, - "end": 6992, + "start": 6982, + "end": 6997, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 6977, - "end": 6978, + "start": 6982, + "end": 6983, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 6977, - "end": 6978, + "start": 6982, + "end": 6983, "ctxt": 0 }, "value": "T", @@ -10741,23 +10741,23 @@ { "type": "TsParenthesizedType", "span": { - "start": 6981, - "end": 6992, + "start": 6986, + "end": 6997, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 6982, - "end": 6991, + "start": 6987, + "end": 6996, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 6982, - "end": 6984, + "start": 6987, + "end": 6989, "ctxt": 0 }, "members": [] @@ -10765,8 +10765,8 @@ { "type": "TsKeywordType", "span": { - "start": 6987, - "end": 6991, + "start": 6992, + "end": 6996, "ctxt": 0 }, "kind": "null" @@ -10782,38 +10782,38 @@ ], "decorators": [], "span": { - "start": 6936, - "end": 7105, + "start": 6941, + "end": 7110, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 6994, - "end": 7105, + "start": 6999, + "end": 7110, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 7000, - "end": 7103, + "start": 7005, + "end": 7108, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 7004, - "end": 7016, + "start": 7009, + "end": 7021, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 7004, - "end": 7009, + "start": 7009, + "end": 7014, "ctxt": 0 }, "value": "value", @@ -10822,8 +10822,8 @@ "right": { "type": "NumericLiteral", "span": { - "start": 7014, - "end": 7016, + "start": 7019, + "end": 7021, "ctxt": 0 }, "value": 42.0, @@ -10833,23 +10833,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 7018, - "end": 7051, + "start": 7023, + "end": 7056, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 7028, - "end": 7034, + "start": 7033, + "end": 7039, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 7028, - "end": 7033, + "start": 7033, + "end": 7038, "ctxt": 0 }, "value": "value", @@ -10861,23 +10861,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 7061, - "end": 7103, + "start": 7066, + "end": 7108, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 7071, - "end": 7077, + "start": 7076, + "end": 7082, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 7071, - "end": 7076, + "start": 7076, + "end": 7081, "ctxt": 0 }, "value": "value", @@ -10894,23 +10894,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 6948, - "end": 6969, + "start": 6953, + "end": 6974, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 6949, - "end": 6968, + "start": 6954, + "end": 6973, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 6949, - "end": 6950, + "start": 6954, + "end": 6955, "ctxt": 0 }, "value": "T", @@ -10922,16 +10922,16 @@ "constraint": { "type": "TsUnionType", "span": { - "start": 6959, - "end": 6968, + "start": 6964, + "end": 6973, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 6959, - "end": 6961, + "start": 6964, + "end": 6966, "ctxt": 0 }, "members": [] @@ -10939,8 +10939,8 @@ { "type": "TsKeywordType", "span": { - "start": 6964, - "end": 6968, + "start": 6969, + "end": 6973, "ctxt": 0 }, "kind": "null" @@ -10958,8 +10958,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 7116, - "end": 7119, + "start": 7121, + "end": 7124, "ctxt": 0 }, "value": "fx5", @@ -10970,16 +10970,16 @@ { "type": "Parameter", "span": { - "start": 7153, - "end": 7175, + "start": 7158, + "end": 7180, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 7153, - "end": 7175, + "start": 7158, + "end": 7180, "ctxt": 0 }, "value": "value", @@ -10987,30 +10987,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 7158, - "end": 7175, + "start": 7163, + "end": 7180, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 7160, - "end": 7175, + "start": 7165, + "end": 7180, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 7160, - "end": 7161, + "start": 7165, + "end": 7166, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 7160, - "end": 7161, + "start": 7165, + "end": 7166, "ctxt": 0 }, "value": "T", @@ -11021,23 +11021,23 @@ { "type": "TsParenthesizedType", "span": { - "start": 7164, - "end": 7175, + "start": 7169, + "end": 7180, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 7165, - "end": 7174, + "start": 7170, + "end": 7179, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 7165, - "end": 7167, + "start": 7170, + "end": 7172, "ctxt": 0 }, "members": [] @@ -11045,8 +11045,8 @@ { "type": "TsKeywordType", "span": { - "start": 7170, - "end": 7174, + "start": 7175, + "end": 7179, "ctxt": 0 }, "kind": "null" @@ -11062,38 +11062,38 @@ ], "decorators": [], "span": { - "start": 7107, - "end": 7288, + "start": 7112, + "end": 7293, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 7177, - "end": 7288, + "start": 7182, + "end": 7293, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 7183, - "end": 7286, + "start": 7188, + "end": 7291, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 7187, - "end": 7199, + "start": 7192, + "end": 7204, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 7187, - "end": 7192, + "start": 7192, + "end": 7197, "ctxt": 0 }, "value": "value", @@ -11102,8 +11102,8 @@ "right": { "type": "NumericLiteral", "span": { - "start": 7197, - "end": 7199, + "start": 7202, + "end": 7204, "ctxt": 0 }, "value": 42.0, @@ -11113,23 +11113,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 7201, - "end": 7234, + "start": 7206, + "end": 7239, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 7211, - "end": 7217, + "start": 7216, + "end": 7222, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 7211, - "end": 7216, + "start": 7216, + "end": 7221, "ctxt": 0 }, "value": "value", @@ -11141,23 +11141,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 7244, - "end": 7286, + "start": 7249, + "end": 7291, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 7254, - "end": 7260, + "start": 7259, + "end": 7265, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 7254, - "end": 7259, + "start": 7259, + "end": 7264, "ctxt": 0 }, "value": "value", @@ -11174,23 +11174,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 7119, - "end": 7152, + "start": 7124, + "end": 7157, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 7120, - "end": 7151, + "start": 7125, + "end": 7156, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 7120, - "end": 7121, + "start": 7125, + "end": 7126, "ctxt": 0 }, "value": "T", @@ -11202,16 +11202,16 @@ "constraint": { "type": "TsUnionType", "span": { - "start": 7130, - "end": 7151, + "start": 7135, + "end": 7156, "ctxt": 0 }, "types": [ { "type": "TsTypeLiteral", "span": { - "start": 7130, - "end": 7132, + "start": 7135, + "end": 7137, "ctxt": 0 }, "members": [] @@ -11219,8 +11219,8 @@ { "type": "TsKeywordType", "span": { - "start": 7135, - "end": 7139, + "start": 7140, + "end": 7144, "ctxt": 0 }, "kind": "null" @@ -11228,8 +11228,8 @@ { "type": "TsKeywordType", "span": { - "start": 7142, - "end": 7151, + "start": 7147, + "end": 7156, "ctxt": 0 }, "kind": "undefined" @@ -11247,8 +11247,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 7327, - "end": 7331, + "start": 7332, + "end": 7336, "ctxt": 0 }, "value": "fx10", @@ -11259,16 +11259,16 @@ { "type": "Parameter", "span": { - "start": 7332, - "end": 7350, + "start": 7337, + "end": 7355, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 7332, - "end": 7350, + "start": 7337, + "end": 7355, "ctxt": 0 }, "value": "x", @@ -11276,23 +11276,23 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 7333, - "end": 7350, + "start": 7338, + "end": 7355, "ctxt": 0 }, "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 7335, - "end": 7350, + "start": 7340, + "end": 7355, "ctxt": 0 }, "types": [ { "type": "TsKeywordType", "span": { - "start": 7335, - "end": 7341, + "start": 7340, + "end": 7346, "ctxt": 0 }, "kind": "string" @@ -11300,8 +11300,8 @@ { "type": "TsKeywordType", "span": { - "start": 7344, - "end": 7350, + "start": 7349, + "end": 7355, "ctxt": 0 }, "kind": "number" @@ -11314,16 +11314,16 @@ { "type": "Parameter", "span": { - "start": 7352, - "end": 7361, + "start": 7357, + "end": 7366, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 7352, - "end": 7361, + "start": 7357, + "end": 7366, "ctxt": 0 }, "value": "y", @@ -11331,15 +11331,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 7353, - "end": 7361, + "start": 7358, + "end": 7366, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 7355, - "end": 7361, + "start": 7360, + "end": 7366, "ctxt": 0 }, "kind": "number" @@ -11350,38 +11350,38 @@ ], "decorators": [], "span": { - "start": 7318, - "end": 7572, + "start": 7323, + "end": 7577, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 7363, - "end": 7572, + "start": 7368, + "end": 7577, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 7369, - "end": 7467, + "start": 7374, + "end": 7472, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 7373, - "end": 7379, + "start": 7378, + "end": 7384, "ctxt": 0 }, "operator": "==", "left": { "type": "Identifier", "span": { - "start": 7373, - "end": 7374, + "start": 7378, + "end": 7379, "ctxt": 0 }, "value": "x", @@ -11390,8 +11390,8 @@ "right": { "type": "Identifier", "span": { - "start": 7378, - "end": 7379, + "start": 7383, + "end": 7384, "ctxt": 0 }, "value": "y", @@ -11401,23 +11401,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 7381, - "end": 7419, + "start": 7386, + "end": 7424, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 7391, - "end": 7393, + "start": 7396, + "end": 7398, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 7391, - "end": 7392, + "start": 7396, + "end": 7397, "ctxt": 0 }, "value": "x", @@ -11429,23 +11429,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 7429, - "end": 7467, + "start": 7434, + "end": 7472, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 7439, - "end": 7441, + "start": 7444, + "end": 7446, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 7439, - "end": 7440, + "start": 7444, + "end": 7445, "ctxt": 0 }, "value": "x", @@ -11458,23 +11458,23 @@ { "type": "IfStatement", "span": { - "start": 7472, - "end": 7570, + "start": 7477, + "end": 7575, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 7476, - "end": 7482, + "start": 7481, + "end": 7487, "ctxt": 0 }, "operator": "!=", "left": { "type": "Identifier", "span": { - "start": 7476, - "end": 7477, + "start": 7481, + "end": 7482, "ctxt": 0 }, "value": "x", @@ -11483,8 +11483,8 @@ "right": { "type": "Identifier", "span": { - "start": 7481, - "end": 7482, + "start": 7486, + "end": 7487, "ctxt": 0 }, "value": "y", @@ -11494,23 +11494,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 7484, - "end": 7522, + "start": 7489, + "end": 7527, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 7494, - "end": 7496, + "start": 7499, + "end": 7501, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 7494, - "end": 7495, + "start": 7499, + "end": 7500, "ctxt": 0 }, "value": "x", @@ -11522,23 +11522,23 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 7532, - "end": 7570, + "start": 7537, + "end": 7575, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 7542, - "end": 7544, + "start": 7547, + "end": 7549, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 7542, - "end": 7543, + "start": 7547, + "end": 7548, "ctxt": 0 }, "value": "x", @@ -11560,8 +11560,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 7606, - "end": 7614, + "start": 7611, + "end": 7619, "ctxt": 0 }, "value": "SendBlob", @@ -11572,16 +11572,16 @@ { "type": "Parameter", "span": { - "start": 7615, - "end": 7632, + "start": 7620, + "end": 7637, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 7615, - "end": 7632, + "start": 7620, + "end": 7637, "ctxt": 0 }, "value": "encoding", @@ -11589,15 +11589,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 7623, - "end": 7632, + "start": 7628, + "end": 7637, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 7625, - "end": 7632, + "start": 7630, + "end": 7637, "ctxt": 0 }, "kind": "unknown" @@ -11608,46 +11608,46 @@ ], "decorators": [], "span": { - "start": 7597, - "end": 7751, + "start": 7602, + "end": 7756, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 7634, - "end": 7751, + "start": 7639, + "end": 7756, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 7640, - "end": 7735, + "start": 7645, + "end": 7740, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 7644, - "end": 7689, + "start": 7649, + "end": 7694, "ctxt": 0 }, "operator": "&&", "left": { "type": "BinaryExpression", "span": { - "start": 7644, - "end": 7666, + "start": 7649, + "end": 7671, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 7644, - "end": 7652, + "start": 7649, + "end": 7657, "ctxt": 0 }, "value": "encoding", @@ -11656,8 +11656,8 @@ "right": { "type": "Identifier", "span": { - "start": 7657, - "end": 7666, + "start": 7662, + "end": 7671, "ctxt": 0 }, "value": "undefined", @@ -11667,16 +11667,16 @@ "right": { "type": "BinaryExpression", "span": { - "start": 7670, - "end": 7689, + "start": 7675, + "end": 7694, "ctxt": 0 }, "operator": "!==", "left": { "type": "Identifier", "span": { - "start": 7670, - "end": 7678, + "start": 7675, + "end": 7683, "ctxt": 0 }, "value": "encoding", @@ -11685,8 +11685,8 @@ "right": { "type": "StringLiteral", "span": { - "start": 7683, - "end": 7689, + "start": 7688, + "end": 7694, "ctxt": 0 }, "value": "utf8", @@ -11697,30 +11697,30 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 7691, - "end": 7735, + "start": 7696, + "end": 7740, "ctxt": 0 }, "stmts": [ { "type": "ThrowStatement", "span": { - "start": 7701, - "end": 7729, + "start": 7706, + "end": 7734, "ctxt": 0 }, "argument": { "type": "NewExpression", "span": { - "start": 7707, - "end": 7728, + "start": 7712, + "end": 7733, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 7711, - "end": 7716, + "start": 7716, + "end": 7721, "ctxt": 0 }, "value": "Error", @@ -11732,8 +11732,8 @@ "expression": { "type": "StringLiteral", "span": { - "start": 7717, - "end": 7727, + "start": 7722, + "end": 7732, "ctxt": 0 }, "value": "encoding", @@ -11751,15 +11751,15 @@ { "type": "ExpressionStatement", "span": { - "start": 7740, - "end": 7749, + "start": 7745, + "end": 7754, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 7740, - "end": 7748, + "start": 7745, + "end": 7753, "ctxt": 0 }, "value": "encoding", @@ -11776,8 +11776,8 @@ { "type": "EmptyStatement", "span": { - "start": 7751, - "end": 7752, + "start": 7756, + "end": 7757, "ctxt": 0 } }, @@ -11786,8 +11786,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 7763, - "end": 7775, + "start": 7768, + "end": 7780, "ctxt": 0 }, "value": "doSomething1", @@ -11798,16 +11798,16 @@ { "type": "Parameter", "span": { - "start": 7795, - "end": 7803, + "start": 7800, + "end": 7808, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 7795, - "end": 7803, + "start": 7800, + "end": 7808, "ctxt": 0 }, "value": "value", @@ -11815,22 +11815,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 7800, - "end": 7803, + "start": 7805, + "end": 7808, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 7802, - "end": 7803, + "start": 7807, + "end": 7808, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 7802, - "end": 7803, + "start": 7807, + "end": 7808, "ctxt": 0 }, "value": "T", @@ -11844,38 +11844,38 @@ ], "decorators": [], "span": { - "start": 7754, - "end": 7964, + "start": 7759, + "end": 7969, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 7808, - "end": 7964, + "start": 7813, + "end": 7969, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 7814, - "end": 7868, + "start": 7819, + "end": 7873, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 7818, - "end": 7837, + "start": 7823, + "end": 7842, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 7818, - "end": 7823, + "start": 7823, + "end": 7828, "ctxt": 0 }, "value": "value", @@ -11884,8 +11884,8 @@ "right": { "type": "Identifier", "span": { - "start": 7828, - "end": 7837, + "start": 7833, + "end": 7842, "ctxt": 0 }, "value": "undefined", @@ -11895,23 +11895,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 7839, - "end": 7868, + "start": 7844, + "end": 7873, "ctxt": 0 }, "stmts": [ { "type": "ReturnStatement", "span": { - "start": 7849, - "end": 7862, + "start": 7854, + "end": 7867, "ctxt": 0 }, "argument": { "type": "Identifier", "span": { - "start": 7856, - "end": 7861, + "start": 7861, + "end": 7866, "ctxt": 0 }, "value": "value", @@ -11925,23 +11925,23 @@ { "type": "IfStatement", "span": { - "start": 7873, - "end": 7944, + "start": 7878, + "end": 7949, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 7877, - "end": 7889, + "start": 7882, + "end": 7894, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 7877, - "end": 7882, + "start": 7882, + "end": 7887, "ctxt": 0 }, "value": "value", @@ -11950,8 +11950,8 @@ "right": { "type": "NumericLiteral", "span": { - "start": 7887, - "end": 7889, + "start": 7892, + "end": 7894, "ctxt": 0 }, "value": 42.0, @@ -11961,30 +11961,30 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 7891, - "end": 7944, + "start": 7896, + "end": 7949, "ctxt": 0 }, "stmts": [ { "type": "ThrowStatement", "span": { - "start": 7901, - "end": 7938, + "start": 7906, + "end": 7943, "ctxt": 0 }, "argument": { "type": "CallExpression", "span": { - "start": 7907, - "end": 7937, + "start": 7912, + "end": 7942, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 7907, - "end": 7912, + "start": 7912, + "end": 7917, "ctxt": 0 }, "value": "Error", @@ -11996,8 +11996,8 @@ "expression": { "type": "StringLiteral", "span": { - "start": 7913, - "end": 7936, + "start": 7918, + "end": 7941, "ctxt": 0 }, "value": "Meaning of life value", @@ -12015,15 +12015,15 @@ { "type": "ReturnStatement", "span": { - "start": 7949, - "end": 7962, + "start": 7954, + "end": 7967, "ctxt": 0 }, "argument": { "type": "Identifier", "span": { - "start": 7956, - "end": 7961, + "start": 7961, + "end": 7966, "ctxt": 0 }, "value": "value", @@ -12037,23 +12037,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 7775, - "end": 7794, + "start": 7780, + "end": 7799, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 7776, - "end": 7793, + "start": 7781, + "end": 7798, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 7776, - "end": 7777, + "start": 7781, + "end": 7782, "ctxt": 0 }, "value": "T", @@ -12065,8 +12065,8 @@ "constraint": { "type": "TsKeywordType", "span": { - "start": 7786, - "end": 7793, + "start": 7791, + "end": 7798, "ctxt": 0 }, "kind": "unknown" @@ -12078,22 +12078,22 @@ "returnType": { "type": "TsTypeAnnotation", "span": { - "start": 7804, - "end": 7807, + "start": 7809, + "end": 7812, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 7806, - "end": 7807, + "start": 7811, + "end": 7812, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 7806, - "end": 7807, + "start": 7811, + "end": 7812, "ctxt": 0 }, "value": "T", @@ -12108,8 +12108,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 7975, - "end": 7987, + "start": 7980, + "end": 7992, "ctxt": 0 }, "value": "doSomething2", @@ -12120,16 +12120,16 @@ { "type": "Parameter", "span": { - "start": 7988, - "end": 8002, + "start": 7993, + "end": 8007, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 7988, - "end": 8002, + "start": 7993, + "end": 8007, "ctxt": 0 }, "value": "value", @@ -12137,15 +12137,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 7993, - "end": 8002, + "start": 7998, + "end": 8007, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 7995, - "end": 8002, + "start": 8000, + "end": 8007, "ctxt": 0 }, "kind": "unknown" @@ -12156,38 +12156,38 @@ ], "decorators": [], "span": { - "start": 7966, - "end": 8111, + "start": 7971, + "end": 8116, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 8010, - "end": 8111, + "start": 8015, + "end": 8116, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 8016, - "end": 8064, + "start": 8021, + "end": 8069, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 8020, - "end": 8039, + "start": 8025, + "end": 8044, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 8020, - "end": 8025, + "start": 8025, + "end": 8030, "ctxt": 0 }, "value": "value", @@ -12196,8 +12196,8 @@ "right": { "type": "Identifier", "span": { - "start": 8030, - "end": 8039, + "start": 8035, + "end": 8044, "ctxt": 0 }, "value": "undefined", @@ -12207,16 +12207,16 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 8041, - "end": 8064, + "start": 8046, + "end": 8069, "ctxt": 0 }, "stmts": [ { "type": "ReturnStatement", "span": { - "start": 8051, - "end": 8058, + "start": 8056, + "end": 8063, "ctxt": 0 }, "argument": null @@ -12228,23 +12228,23 @@ { "type": "IfStatement", "span": { - "start": 8069, - "end": 8109, + "start": 8074, + "end": 8114, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 8073, - "end": 8085, + "start": 8078, + "end": 8090, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 8073, - "end": 8078, + "start": 8078, + "end": 8083, "ctxt": 0 }, "value": "value", @@ -12253,8 +12253,8 @@ "right": { "type": "NumericLiteral", "span": { - "start": 8083, - "end": 8085, + "start": 8088, + "end": 8090, "ctxt": 0 }, "value": 42.0, @@ -12264,23 +12264,23 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 8087, - "end": 8109, + "start": 8092, + "end": 8114, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 8097, - "end": 8103, + "start": 8102, + "end": 8108, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 8097, - "end": 8102, + "start": 8102, + "end": 8107, "ctxt": 0 }, "value": "value", @@ -12299,15 +12299,15 @@ "returnType": { "type": "TsTypeAnnotation", "span": { - "start": 8003, - "end": 8009, + "start": 8008, + "end": 8014, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 8005, - "end": 8009, + "start": 8010, + "end": 8014, "ctxt": 0 }, "kind": "void" @@ -12317,16 +12317,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 8135, - "end": 8175, + "start": 8140, + "end": 8180, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 8140, - "end": 8145, + "start": 8145, + "end": 8150, "ctxt": 0 }, "value": "TypeA", @@ -12336,24 +12336,24 @@ "typeAnnotation": { "type": "TsTypeLiteral", "span": { - "start": 8148, - "end": 8175, + "start": 8153, + "end": 8180, "ctxt": 0 }, "members": [ { "type": "TsPropertySignature", "span": { - "start": 8154, - "end": 8161, + "start": 8159, + "end": 8166, "ctxt": 0 }, "readonly": false, "key": { "type": "Identifier", "span": { - "start": 8154, - "end": 8155, + "start": 8159, + "end": 8160, "ctxt": 0 }, "value": "A", @@ -12366,22 +12366,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8155, - "end": 8160, + "start": 8160, + "end": 8165, "ctxt": 0 }, "typeAnnotation": { "type": "TsLiteralType", "span": { - "start": 8157, - "end": 8160, + "start": 8162, + "end": 8165, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 8157, - "end": 8160, + "start": 8162, + "end": 8165, "ctxt": 0 }, "value": "A", @@ -12394,16 +12394,16 @@ { "type": "TsPropertySignature", "span": { - "start": 8166, - "end": 8173, + "start": 8171, + "end": 8178, "ctxt": 0 }, "readonly": false, "key": { "type": "Identifier", "span": { - "start": 8166, - "end": 8167, + "start": 8171, + "end": 8172, "ctxt": 0 }, "value": "B", @@ -12416,22 +12416,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8167, - "end": 8172, + "start": 8172, + "end": 8177, "ctxt": 0 }, "typeAnnotation": { "type": "TsLiteralType", "span": { - "start": 8169, - "end": 8172, + "start": 8174, + "end": 8177, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 8169, - "end": 8172, + "start": 8174, + "end": 8177, "ctxt": 0 }, "value": "B", @@ -12447,16 +12447,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 8177, - "end": 8229, + "start": 8182, + "end": 8234, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 8182, - "end": 8187, + "start": 8187, + "end": 8192, "ctxt": 0 }, "value": "TypeB", @@ -12466,24 +12466,24 @@ "typeAnnotation": { "type": "TsTypeLiteral", "span": { - "start": 8190, - "end": 8229, + "start": 8195, + "end": 8234, "ctxt": 0 }, "members": [ { "type": "TsPropertySignature", "span": { - "start": 8196, - "end": 8203, + "start": 8201, + "end": 8208, "ctxt": 0 }, "readonly": false, "key": { "type": "Identifier", "span": { - "start": 8196, - "end": 8197, + "start": 8201, + "end": 8202, "ctxt": 0 }, "value": "A", @@ -12496,22 +12496,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8197, - "end": 8202, + "start": 8202, + "end": 8207, "ctxt": 0 }, "typeAnnotation": { "type": "TsLiteralType", "span": { - "start": 8199, - "end": 8202, + "start": 8204, + "end": 8207, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 8199, - "end": 8202, + "start": 8204, + "end": 8207, "ctxt": 0 }, "value": "A", @@ -12524,16 +12524,16 @@ { "type": "TsPropertySignature", "span": { - "start": 8208, - "end": 8215, + "start": 8213, + "end": 8220, "ctxt": 0 }, "readonly": false, "key": { "type": "Identifier", "span": { - "start": 8208, - "end": 8209, + "start": 8213, + "end": 8214, "ctxt": 0 }, "value": "B", @@ -12546,22 +12546,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8209, - "end": 8214, + "start": 8214, + "end": 8219, "ctxt": 0 }, "typeAnnotation": { "type": "TsLiteralType", "span": { - "start": 8211, - "end": 8214, + "start": 8216, + "end": 8219, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 8211, - "end": 8214, + "start": 8216, + "end": 8219, "ctxt": 0 }, "value": "B", @@ -12574,16 +12574,16 @@ { "type": "TsPropertySignature", "span": { - "start": 8220, - "end": 8227, + "start": 8225, + "end": 8232, "ctxt": 0 }, "readonly": false, "key": { "type": "Identifier", "span": { - "start": 8220, - "end": 8221, + "start": 8225, + "end": 8226, "ctxt": 0 }, "value": "C", @@ -12596,22 +12596,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8221, - "end": 8226, + "start": 8226, + "end": 8231, "ctxt": 0 }, "typeAnnotation": { "type": "TsLiteralType", "span": { - "start": 8223, - "end": 8226, + "start": 8228, + "end": 8231, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 8223, - "end": 8226, + "start": 8228, + "end": 8231, "ctxt": 0 }, "value": "C", @@ -12627,16 +12627,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 8231, - "end": 8320, + "start": 8236, + "end": 8325, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 8236, - "end": 8237, + "start": 8241, + "end": 8242, "ctxt": 0 }, "value": "R", @@ -12645,23 +12645,23 @@ "typeParams": { "type": "TsTypeParameterDeclaration", "span": { - "start": 8237, - "end": 8260, + "start": 8242, + "end": 8265, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 8238, - "end": 8259, + "start": 8243, + "end": 8264, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 8238, - "end": 8239, + "start": 8243, + "end": 8244, "ctxt": 0 }, "value": "T", @@ -12673,23 +12673,23 @@ "constraint": { "type": "TsTypeOperator", "span": { - "start": 8248, - "end": 8259, + "start": 8253, + "end": 8264, "ctxt": 0 }, "op": "keyof", "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 8254, - "end": 8259, + "start": 8259, + "end": 8264, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8254, - "end": 8259, + "start": 8259, + "end": 8264, "ctxt": 0 }, "value": "TypeA", @@ -12705,22 +12705,22 @@ "typeAnnotation": { "type": "TsConditionalType", "span": { - "start": 8267, - "end": 8319, + "start": 8272, + "end": 8324, "ctxt": 0 }, "checkType": { "type": "TsTypeReference", "span": { - "start": 8267, - "end": 8268, + "start": 8272, + "end": 8273, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8267, - "end": 8268, + "start": 8272, + "end": 8273, "ctxt": 0 }, "value": "T", @@ -12731,23 +12731,23 @@ "extendsType": { "type": "TsTypeOperator", "span": { - "start": 8277, - "end": 8288, + "start": 8282, + "end": 8293, "ctxt": 0 }, "op": "keyof", "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 8283, - "end": 8288, + "start": 8288, + "end": 8293, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8283, - "end": 8288, + "start": 8288, + "end": 8293, "ctxt": 0 }, "value": "TypeB", @@ -12759,39 +12759,39 @@ "trueType": { "type": "TsTupleType", "span": { - "start": 8291, - "end": 8311, + "start": 8296, + "end": 8316, "ctxt": 0 }, "elemTypes": [ { "type": "TsTupleElement", "span": { - "start": 8292, - "end": 8300, + "start": 8297, + "end": 8305, "ctxt": 0 }, "label": null, "ty": { "type": "TsIndexedAccessType", "span": { - "start": 8292, - "end": 8300, + "start": 8297, + "end": 8305, "ctxt": 0 }, "readonly": false, "objectType": { "type": "TsTypeReference", "span": { - "start": 8292, - "end": 8297, + "start": 8297, + "end": 8302, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8292, - "end": 8297, + "start": 8297, + "end": 8302, "ctxt": 0 }, "value": "TypeA", @@ -12802,15 +12802,15 @@ "indexType": { "type": "TsTypeReference", "span": { - "start": 8298, - "end": 8299, + "start": 8303, + "end": 8304, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8298, - "end": 8299, + "start": 8303, + "end": 8304, "ctxt": 0 }, "value": "T", @@ -12823,31 +12823,31 @@ { "type": "TsTupleElement", "span": { - "start": 8302, - "end": 8310, + "start": 8307, + "end": 8315, "ctxt": 0 }, "label": null, "ty": { "type": "TsIndexedAccessType", "span": { - "start": 8302, - "end": 8310, + "start": 8307, + "end": 8315, "ctxt": 0 }, "readonly": false, "objectType": { "type": "TsTypeReference", "span": { - "start": 8302, - "end": 8307, + "start": 8307, + "end": 8312, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8302, - "end": 8307, + "start": 8307, + "end": 8312, "ctxt": 0 }, "value": "TypeB", @@ -12858,15 +12858,15 @@ "indexType": { "type": "TsTypeReference", "span": { - "start": 8308, - "end": 8309, + "start": 8313, + "end": 8314, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8308, - "end": 8309, + "start": 8313, + "end": 8314, "ctxt": 0 }, "value": "T", @@ -12881,8 +12881,8 @@ "falseType": { "type": "TsKeywordType", "span": { - "start": 8314, - "end": 8319, + "start": 8319, + "end": 8324, "ctxt": 0 }, "kind": "never" @@ -12892,16 +12892,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 8322, - "end": 8444, + "start": 8327, + "end": 8449, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 8327, - "end": 8329, + "start": 8332, + "end": 8334, "ctxt": 0 }, "value": "R2", @@ -12910,23 +12910,23 @@ "typeParams": { "type": "TsTypeParameterDeclaration", "span": { - "start": 8329, - "end": 8352, + "start": 8334, + "end": 8357, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 8330, - "end": 8351, + "start": 8335, + "end": 8356, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 8330, - "end": 8331, + "start": 8335, + "end": 8336, "ctxt": 0 }, "value": "T", @@ -12938,15 +12938,15 @@ "constraint": { "type": "TsTypeReference", "span": { - "start": 8340, - "end": 8351, + "start": 8345, + "end": 8356, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8340, - "end": 8351, + "start": 8345, + "end": 8356, "ctxt": 0 }, "value": "PropertyKey", @@ -12961,22 +12961,22 @@ "typeAnnotation": { "type": "TsConditionalType", "span": { - "start": 8359, - "end": 8443, + "start": 8364, + "end": 8448, "ctxt": 0 }, "checkType": { "type": "TsTypeReference", "span": { - "start": 8359, - "end": 8360, + "start": 8364, + "end": 8365, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8359, - "end": 8360, + "start": 8364, + "end": 8365, "ctxt": 0 }, "value": "T", @@ -12987,23 +12987,23 @@ "extendsType": { "type": "TsTypeOperator", "span": { - "start": 8369, - "end": 8380, + "start": 8374, + "end": 8385, "ctxt": 0 }, "op": "keyof", "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 8375, - "end": 8380, + "start": 8380, + "end": 8385, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8375, - "end": 8380, + "start": 8380, + "end": 8385, "ctxt": 0 }, "value": "TypeA", @@ -13015,22 +13015,22 @@ "trueType": { "type": "TsConditionalType", "span": { - "start": 8383, - "end": 8435, + "start": 8388, + "end": 8440, "ctxt": 0 }, "checkType": { "type": "TsTypeReference", "span": { - "start": 8383, - "end": 8384, + "start": 8388, + "end": 8389, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8383, - "end": 8384, + "start": 8388, + "end": 8389, "ctxt": 0 }, "value": "T", @@ -13041,23 +13041,23 @@ "extendsType": { "type": "TsTypeOperator", "span": { - "start": 8393, - "end": 8404, + "start": 8398, + "end": 8409, "ctxt": 0 }, "op": "keyof", "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 8399, - "end": 8404, + "start": 8404, + "end": 8409, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8399, - "end": 8404, + "start": 8404, + "end": 8409, "ctxt": 0 }, "value": "TypeB", @@ -13069,39 +13069,39 @@ "trueType": { "type": "TsTupleType", "span": { - "start": 8407, - "end": 8427, + "start": 8412, + "end": 8432, "ctxt": 0 }, "elemTypes": [ { "type": "TsTupleElement", "span": { - "start": 8408, - "end": 8416, + "start": 8413, + "end": 8421, "ctxt": 0 }, "label": null, "ty": { "type": "TsIndexedAccessType", "span": { - "start": 8408, - "end": 8416, + "start": 8413, + "end": 8421, "ctxt": 0 }, "readonly": false, "objectType": { "type": "TsTypeReference", "span": { - "start": 8408, - "end": 8413, + "start": 8413, + "end": 8418, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8408, - "end": 8413, + "start": 8413, + "end": 8418, "ctxt": 0 }, "value": "TypeA", @@ -13112,15 +13112,15 @@ "indexType": { "type": "TsTypeReference", "span": { - "start": 8414, - "end": 8415, + "start": 8419, + "end": 8420, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8414, - "end": 8415, + "start": 8419, + "end": 8420, "ctxt": 0 }, "value": "T", @@ -13133,31 +13133,31 @@ { "type": "TsTupleElement", "span": { - "start": 8418, - "end": 8426, + "start": 8423, + "end": 8431, "ctxt": 0 }, "label": null, "ty": { "type": "TsIndexedAccessType", "span": { - "start": 8418, - "end": 8426, + "start": 8423, + "end": 8431, "ctxt": 0 }, "readonly": false, "objectType": { "type": "TsTypeReference", "span": { - "start": 8418, - "end": 8423, + "start": 8423, + "end": 8428, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8418, - "end": 8423, + "start": 8423, + "end": 8428, "ctxt": 0 }, "value": "TypeB", @@ -13168,15 +13168,15 @@ "indexType": { "type": "TsTypeReference", "span": { - "start": 8424, - "end": 8425, + "start": 8429, + "end": 8430, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8424, - "end": 8425, + "start": 8429, + "end": 8430, "ctxt": 0 }, "value": "T", @@ -13191,8 +13191,8 @@ "falseType": { "type": "TsKeywordType", "span": { - "start": 8430, - "end": 8435, + "start": 8435, + "end": 8440, "ctxt": 0 }, "kind": "never" @@ -13201,8 +13201,8 @@ "falseType": { "type": "TsKeywordType", "span": { - "start": 8438, - "end": 8443, + "start": 8443, + "end": 8448, "ctxt": 0 }, "kind": "never" @@ -13212,16 +13212,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 8468, - "end": 8488, + "start": 8473, + "end": 8493, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 8473, - "end": 8475, + "start": 8478, + "end": 8480, "ctxt": 0 }, "value": "AB", @@ -13231,23 +13231,23 @@ "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 8478, - "end": 8487, + "start": 8483, + "end": 8492, "ctxt": 0 }, "types": [ { "type": "TsLiteralType", "span": { - "start": 8478, - "end": 8481, + "start": 8483, + "end": 8486, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 8478, - "end": 8481, + "start": 8483, + "end": 8486, "ctxt": 0 }, "value": "A", @@ -13257,15 +13257,15 @@ { "type": "TsLiteralType", "span": { - "start": 8484, - "end": 8487, + "start": 8489, + "end": 8492, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 8484, - "end": 8487, + "start": 8489, + "end": 8492, "ctxt": 0 }, "value": "B", @@ -13280,8 +13280,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 8499, - "end": 8500, + "start": 8504, + "end": 8505, "ctxt": 0 }, "value": "x", @@ -13292,16 +13292,16 @@ { "type": "Parameter", "span": { - "start": 8518, - "end": 8537, + "start": 8523, + "end": 8542, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 8518, - "end": 8537, + "start": 8523, + "end": 8542, "ctxt": 0 }, "value": "x", @@ -13309,30 +13309,30 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8519, - "end": 8537, + "start": 8524, + "end": 8542, "ctxt": 0 }, "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 8521, - "end": 8537, + "start": 8526, + "end": 8542, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 8521, - "end": 8525, + "start": 8526, + "end": 8530, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8521, - "end": 8525, + "start": 8526, + "end": 8530, "ctxt": 0 }, "value": "T_AB", @@ -13343,8 +13343,8 @@ { "type": "TsKeywordType", "span": { - "start": 8528, - "end": 8537, + "start": 8533, + "end": 8542, "ctxt": 0 }, "kind": "undefined" @@ -13357,16 +13357,16 @@ { "type": "Parameter", "span": { - "start": 8539, - "end": 8545, + "start": 8544, + "end": 8550, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 8539, - "end": 8545, + "start": 8544, + "end": 8550, "ctxt": 0 }, "value": "y", @@ -13374,15 +13374,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8540, - "end": 8545, + "start": 8545, + "end": 8550, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 8542, - "end": 8545, + "start": 8547, + "end": 8550, "ctxt": 0 }, "kind": "any" @@ -13393,23 +13393,23 @@ ], "decorators": [], "span": { - "start": 8490, - "end": 8593, + "start": 8495, + "end": 8598, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 8547, - "end": 8593, + "start": 8552, + "end": 8598, "ctxt": 0 }, "stmts": [ { "type": "VariableDeclaration", "span": { - "start": 8553, - "end": 8591, + "start": 8558, + "end": 8596, "ctxt": 0 }, "kind": "let", @@ -13418,15 +13418,15 @@ { "type": "VariableDeclarator", "span": { - "start": 8557, - "end": 8590, + "start": 8562, + "end": 8595, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 8557, - "end": 8559, + "start": 8562, + "end": 8564, "ctxt": 0 }, "value": "r2", @@ -13434,15 +13434,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8559, - "end": 8566, + "start": 8564, + "end": 8571, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 8561, - "end": 8566, + "start": 8566, + "end": 8571, "ctxt": 0 }, "kind": "never" @@ -13452,15 +13452,15 @@ "init": { "type": "TsAsExpression", "span": { - "start": 8569, - "end": 8590, + "start": 8574, + "end": 8595, "ctxt": 0 }, "expression": { "type": "Identifier", "span": { - "start": 8569, - "end": 8570, + "start": 8574, + "end": 8575, "ctxt": 0 }, "value": "y", @@ -13469,23 +13469,23 @@ "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 8574, - "end": 8590, + "start": 8579, + "end": 8595, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 8574, - "end": 8578, + "start": 8579, + "end": 8583, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8574, - "end": 8578, + "start": 8579, + "end": 8583, "ctxt": 0 }, "value": "T_AB", @@ -13496,8 +13496,8 @@ { "type": "TsKeywordType", "span": { - "start": 8581, - "end": 8590, + "start": 8586, + "end": 8595, "ctxt": 0 }, "kind": "undefined" @@ -13516,23 +13516,23 @@ "typeParameters": { "type": "TsTypeParameterDeclaration", "span": { - "start": 8500, - "end": 8517, + "start": 8505, + "end": 8522, "ctxt": 0 }, "parameters": [ { "type": "TsTypeParameter", "span": { - "start": 8501, - "end": 8516, + "start": 8506, + "end": 8521, "ctxt": 0 }, "name": { "type": "Identifier", "span": { - "start": 8501, - "end": 8505, + "start": 8506, + "end": 8510, "ctxt": 0 }, "value": "T_AB", @@ -13544,15 +13544,15 @@ "constraint": { "type": "TsTypeReference", "span": { - "start": 8514, - "end": 8516, + "start": 8519, + "end": 8521, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8514, - "end": 8516, + "start": 8519, + "end": 8521, "ctxt": 0 }, "value": "AB", @@ -13569,16 +13569,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 8618, - "end": 8637, + "start": 8623, + "end": 8642, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 8623, - "end": 8627, + "start": 8628, + "end": 8632, "ctxt": 0 }, "value": "Left", @@ -13588,15 +13588,15 @@ "typeAnnotation": { "type": "TsLiteralType", "span": { - "start": 8630, - "end": 8636, + "start": 8635, + "end": 8641, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 8630, - "end": 8636, + "start": 8635, + "end": 8641, "ctxt": 0 }, "value": "left", @@ -13607,16 +13607,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 8638, - "end": 8680, + "start": 8643, + "end": 8685, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 8643, - "end": 8648, + "start": 8648, + "end": 8653, "ctxt": 0 }, "value": "Right", @@ -13626,23 +13626,23 @@ "typeAnnotation": { "type": "TsIntersectionType", "span": { - "start": 8651, - "end": 8679, + "start": 8656, + "end": 8684, "ctxt": 0 }, "types": [ { "type": "TsLiteralType", "span": { - "start": 8651, - "end": 8658, + "start": 8656, + "end": 8663, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 8651, - "end": 8658, + "start": 8656, + "end": 8663, "ctxt": 0 }, "value": "right", @@ -13652,24 +13652,24 @@ { "type": "TsTypeLiteral", "span": { - "start": 8661, - "end": 8679, + "start": 8666, + "end": 8684, "ctxt": 0 }, "members": [ { "type": "TsPropertySignature", "span": { - "start": 8663, - "end": 8677, + "start": 8668, + "end": 8682, "ctxt": 0 }, "readonly": false, "key": { "type": "Identifier", "span": { - "start": 8663, - "end": 8668, + "start": 8668, + "end": 8673, "ctxt": 0 }, "value": "right", @@ -13682,22 +13682,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8668, - "end": 8677, + "start": 8673, + "end": 8682, "ctxt": 0 }, "typeAnnotation": { "type": "TsLiteralType", "span": { - "start": 8670, - "end": 8677, + "start": 8675, + "end": 8682, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 8670, - "end": 8677, + "start": 8675, + "end": 8682, "ctxt": 0 }, "value": "right", @@ -13715,16 +13715,16 @@ { "type": "TsTypeAliasDeclaration", "span": { - "start": 8681, - "end": 8708, + "start": 8686, + "end": 8713, "ctxt": 0 }, "declare": false, "id": { "type": "Identifier", "span": { - "start": 8686, - "end": 8692, + "start": 8691, + "end": 8697, "ctxt": 0 }, "value": "Either", @@ -13734,23 +13734,23 @@ "typeAnnotation": { "type": "TsUnionType", "span": { - "start": 8695, - "end": 8707, + "start": 8700, + "end": 8712, "ctxt": 0 }, "types": [ { "type": "TsTypeReference", "span": { - "start": 8695, - "end": 8699, + "start": 8700, + "end": 8704, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8695, - "end": 8699, + "start": 8700, + "end": 8704, "ctxt": 0 }, "value": "Left", @@ -13761,15 +13761,15 @@ { "type": "TsTypeReference", "span": { - "start": 8702, - "end": 8707, + "start": 8707, + "end": 8712, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8702, - "end": 8707, + "start": 8707, + "end": 8712, "ctxt": 0 }, "value": "Right", @@ -13785,8 +13785,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 8719, - "end": 8730, + "start": 8724, + "end": 8735, "ctxt": 0 }, "value": "assertNever", @@ -13797,16 +13797,16 @@ { "type": "Parameter", "span": { - "start": 8731, - "end": 8739, + "start": 8736, + "end": 8744, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 8731, - "end": 8739, + "start": 8736, + "end": 8744, "ctxt": 0 }, "value": "v", @@ -13814,15 +13814,15 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8732, - "end": 8739, + "start": 8737, + "end": 8744, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 8734, - "end": 8739, + "start": 8739, + "end": 8744, "ctxt": 0 }, "kind": "never" @@ -13833,37 +13833,37 @@ ], "decorators": [], "span": { - "start": 8710, - "end": 8781, + "start": 8715, + "end": 8786, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 8748, - "end": 8781, + "start": 8753, + "end": 8786, "ctxt": 0 }, "stmts": [ { "type": "ThrowStatement", "span": { - "start": 8754, - "end": 8779, + "start": 8759, + "end": 8784, "ctxt": 0 }, "argument": { "type": "NewExpression", "span": { - "start": 8760, - "end": 8778, + "start": 8765, + "end": 8783, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 8764, - "end": 8769, + "start": 8769, + "end": 8774, "ctxt": 0 }, "value": "Error", @@ -13875,8 +13875,8 @@ "expression": { "type": "StringLiteral", "span": { - "start": 8770, - "end": 8777, + "start": 8775, + "end": 8782, "ctxt": 0 }, "value": "never", @@ -13895,15 +13895,15 @@ "returnType": { "type": "TsTypeAnnotation", "span": { - "start": 8740, - "end": 8747, + "start": 8745, + "end": 8752, "ctxt": 0 }, "typeAnnotation": { "type": "TsKeywordType", "span": { - "start": 8742, - "end": 8747, + "start": 8747, + "end": 8752, "ctxt": 0 }, "kind": "never" @@ -13915,8 +13915,8 @@ "identifier": { "type": "Identifier", "span": { - "start": 8792, - "end": 8796, + "start": 8797, + "end": 8801, "ctxt": 0 }, "value": "fx20", @@ -13927,16 +13927,16 @@ { "type": "Parameter", "span": { - "start": 8797, - "end": 8810, + "start": 8802, + "end": 8815, "ctxt": 0 }, "decorators": [], "pat": { "type": "Identifier", "span": { - "start": 8797, - "end": 8810, + "start": 8802, + "end": 8815, "ctxt": 0 }, "value": "value", @@ -13944,22 +13944,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8802, - "end": 8810, + "start": 8807, + "end": 8815, "ctxt": 0 }, "typeAnnotation": { "type": "TsTypeReference", "span": { - "start": 8804, - "end": 8810, + "start": 8809, + "end": 8815, "ctxt": 0 }, "typeName": { "type": "Identifier", "span": { - "start": 8804, - "end": 8810, + "start": 8809, + "end": 8815, "ctxt": 0 }, "value": "Either", @@ -13973,38 +13973,38 @@ ], "decorators": [], "span": { - "start": 8783, - "end": 9005, + "start": 8788, + "end": 9010, "ctxt": 0 }, "body": { "type": "BlockStatement", "span": { - "start": 8812, - "end": 9005, + "start": 8817, + "end": 9010, "ctxt": 0 }, "stmts": [ { "type": "IfStatement", "span": { - "start": 8818, - "end": 9003, + "start": 8823, + "end": 9008, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 8822, - "end": 8838, + "start": 8827, + "end": 8843, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 8822, - "end": 8827, + "start": 8827, + "end": 8832, "ctxt": 0 }, "value": "value", @@ -14013,8 +14013,8 @@ "right": { "type": "StringLiteral", "span": { - "start": 8832, - "end": 8838, + "start": 8837, + "end": 8843, "ctxt": 0 }, "value": "left", @@ -14024,16 +14024,16 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 8840, - "end": 8882, + "start": 8845, + "end": 8887, "ctxt": 0 }, "stmts": [ { "type": "VariableDeclaration", "span": { - "start": 8850, - "end": 8876, + "start": 8855, + "end": 8881, "ctxt": 0 }, "kind": "const", @@ -14042,15 +14042,15 @@ { "type": "VariableDeclarator", "span": { - "start": 8856, - "end": 8875, + "start": 8861, + "end": 8880, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 8856, - "end": 8859, + "start": 8861, + "end": 8864, "ctxt": 0 }, "value": "foo", @@ -14058,22 +14058,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8859, - "end": 8867, + "start": 8864, + "end": 8872, "ctxt": 0 }, "typeAnnotation": { "type": "TsLiteralType", "span": { - "start": 8861, - "end": 8867, + "start": 8866, + "end": 8872, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 8861, - "end": 8867, + "start": 8866, + "end": 8872, "ctxt": 0 }, "value": "left", @@ -14085,8 +14085,8 @@ "init": { "type": "Identifier", "span": { - "start": 8870, - "end": 8875, + "start": 8875, + "end": 8880, "ctxt": 0 }, "value": "value", @@ -14101,23 +14101,23 @@ "alternate": { "type": "IfStatement", "span": { - "start": 8892, - "end": 9003, + "start": 8897, + "end": 9008, "ctxt": 0 }, "test": { "type": "BinaryExpression", "span": { - "start": 8896, - "end": 8913, + "start": 8901, + "end": 8918, "ctxt": 0 }, "operator": "===", "left": { "type": "Identifier", "span": { - "start": 8896, - "end": 8901, + "start": 8901, + "end": 8906, "ctxt": 0 }, "value": "value", @@ -14126,8 +14126,8 @@ "right": { "type": "StringLiteral", "span": { - "start": 8906, - "end": 8913, + "start": 8911, + "end": 8918, "ctxt": 0 }, "value": "right", @@ -14137,16 +14137,16 @@ "consequent": { "type": "BlockStatement", "span": { - "start": 8915, - "end": 8958, + "start": 8920, + "end": 8963, "ctxt": 0 }, "stmts": [ { "type": "VariableDeclaration", "span": { - "start": 8925, - "end": 8952, + "start": 8930, + "end": 8957, "ctxt": 0 }, "kind": "const", @@ -14155,15 +14155,15 @@ { "type": "VariableDeclarator", "span": { - "start": 8931, - "end": 8951, + "start": 8936, + "end": 8956, "ctxt": 0 }, "id": { "type": "Identifier", "span": { - "start": 8931, - "end": 8934, + "start": 8936, + "end": 8939, "ctxt": 0 }, "value": "bar", @@ -14171,22 +14171,22 @@ "typeAnnotation": { "type": "TsTypeAnnotation", "span": { - "start": 8934, - "end": 8943, + "start": 8939, + "end": 8948, "ctxt": 0 }, "typeAnnotation": { "type": "TsLiteralType", "span": { - "start": 8936, - "end": 8943, + "start": 8941, + "end": 8948, "ctxt": 0 }, "literal": { "type": "StringLiteral", "span": { - "start": 8936, - "end": 8943, + "start": 8941, + "end": 8948, "ctxt": 0 }, "value": "right", @@ -14198,8 +14198,8 @@ "init": { "type": "Identifier", "span": { - "start": 8946, - "end": 8951, + "start": 8951, + "end": 8956, "ctxt": 0 }, "value": "value", @@ -14214,30 +14214,30 @@ "alternate": { "type": "BlockStatement", "span": { - "start": 8968, - "end": 9003, + "start": 8973, + "end": 9008, "ctxt": 0 }, "stmts": [ { "type": "ExpressionStatement", "span": { - "start": 8978, - "end": 8997, + "start": 8983, + "end": 9002, "ctxt": 0 }, "expression": { "type": "CallExpression", "span": { - "start": 8978, - "end": 8996, + "start": 8983, + "end": 9001, "ctxt": 0 }, "callee": { "type": "Identifier", "span": { - "start": 8978, - "end": 8989, + "start": 8983, + "end": 8994, "ctxt": 0 }, "value": "assertNever", @@ -14249,8 +14249,8 @@ "expression": { "type": "Identifier", "span": { - "start": 8990, - "end": 8995, + "start": 8995, + "end": 9000, "ctxt": 0 }, "value": "value", diff --git a/crates/swc_ecma_parser/tests/tsc/unknownControlFlow.ts b/crates/swc_ecma_parser/tests/tsc/unknownControlFlow.ts index 0bd3a6512f17..484a34576280 100644 --- a/crates/swc_ecma_parser/tests/tsc/unknownControlFlow.ts +++ b/crates/swc_ecma_parser/tests/tsc/unknownControlFlow.ts @@ -1,7 +1,7 @@ // @strict: true // @declaration: true -type T01 = {} & string; // string +type T01 = {} & string; // {} & string type T02 = {} & 'a'; // 'a' type T03 = {} & object; // object type T04 = {} & { x: number }; // { x: number } diff --git a/crates/swc_ecma_parser/tests/typescript.rs b/crates/swc_ecma_parser/tests/typescript.rs index 993107b8b5b6..c317bb880be2 100644 --- a/crates/swc_ecma_parser/tests/typescript.rs +++ b/crates/swc_ecma_parser/tests/typescript.rs @@ -139,7 +139,8 @@ fn run_spec(file: &Path, output_json: &Path) { || file_name.contains("tsc/tsxErrorRecovery2") || file_name.contains("tsc/tsxErrorRecovery3") || file_name.contains("tsc/tsxTypeArgumentsJsxPreserveOutput") - || file_name.contains("tsc/unicodeEscapesInJsxtags"); + || file_name.contains("tsc/unicodeEscapesInJsxtags") + || file_name.contains("tsc/propertyAccessNumericLiterals"); if ignore { return;