From 9520beef38902cecccd7cfdca4265346ea75a38d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Dec 2022 15:34:50 +0000 Subject: [PATCH 1/2] Build(deps-dev): bump typescript from 4.8.4 to 4.9.3 Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.8.4 to 4.9.3. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/commits) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8fd31692..9d47965c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "js-yaml": "^4.1.0", "prettier": "^2.7.1", "ts-jest": "^26.5.6", - "typescript": "^4.8.4" + "typescript": "^4.9.3" } }, "node_modules/@actions/core": { @@ -10852,9 +10852,9 @@ } }, "node_modules/typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -19984,9 +19984,9 @@ } }, "typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==" + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==" }, "union-value": { "version": "1.0.1", diff --git a/package.json b/package.json index be56d44e..dbe7c7f1 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,6 @@ "js-yaml": "^4.1.0", "prettier": "^2.7.1", "ts-jest": "^26.5.6", - "typescript": "^4.8.4" + "typescript": "^4.9.3" } } From eba4eb3b42ef62c5b5736a5347739b62f63432cf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 4 Dec 2022 02:42:28 +0000 Subject: [PATCH 2/2] build --- dist/index.js | 21238 ++++++++++++++++++++++++++---------------------- 1 file changed, 11433 insertions(+), 9805 deletions(-) diff --git a/dist/index.js b/dist/index.js index 7edfc2a2..d92cf257 100644 --- a/dist/index.js +++ b/dist/index.js @@ -287151,7 +287151,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -287198,210 +287198,15 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -/* @internal */ -var ts; -(function (ts) { - function createMapData() { - var sentinel = {}; - sentinel.prev = sentinel; - return { head: sentinel, tail: sentinel, size: 0 }; - } - function createMapEntry(key, value) { - return { key: key, value: value, next: undefined, prev: undefined }; - } - function sameValueZero(x, y) { - // Treats -0 === 0 and NaN === NaN - return x === y || x !== x && y !== y; - } - function getPrev(entry) { - var prev = entry.prev; - // Entries without a 'prev' have been removed from the map. - // An entry whose 'prev' points to itself is the head of the list and is invalid here. - if (!prev || prev === entry) - throw new Error("Illegal state"); - return prev; - } - function getNext(entry) { - while (entry) { - // Entries without a 'prev' have been removed from the map. Their 'next' - // pointer should point to the previous entry prior to deletion and - // that entry should be skipped to resume iteration. - var skipNext = !entry.prev; - entry = entry.next; - if (skipNext) { - continue; - } - return entry; - } - } - function getEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - if (sameValueZero(entry.key, key)) { - return entry; - } - } - } - function addOrUpdateEntry(data, key, value) { - var existing = getEntry(data, key); - if (existing) { - existing.value = value; - return; - } - var entry = createMapEntry(key, value); - entry.prev = data.tail; - data.tail.next = entry; - data.tail = entry; - data.size++; - return entry; - } - function deleteEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - // all entries in the map should have a 'prev' pointer. - if (entry.prev === undefined) - throw new Error("Illegal state"); - if (sameValueZero(entry.key, key)) { - if (entry.next) { - entry.next.prev = entry.prev; - } - else { - // an entry in the map without a 'next' pointer must be the 'tail'. - if (data.tail !== entry) - throw new Error("Illegal state"); - data.tail = entry.prev; - } - entry.prev.next = entry.next; - entry.next = entry.prev; - entry.prev = undefined; - data.size--; - return entry; - } - } - } - function clearEntries(data) { - var node = data.tail; - while (node !== data.head) { - var prev = getPrev(node); - node.next = data.head; - node.prev = undefined; - node = prev; - } - data.head.next = undefined; - data.tail = data.head; - data.size = 0; - } - function forEachEntry(data, action) { - var entry = data.head; - while (entry) { - entry = getNext(entry); - if (entry) { - action(entry.value, entry.key); - } - } - } - function forEachIteration(iterator, action) { - if (iterator) { - for (var step = iterator.next(); !step.done; step = iterator.next()) { - action(step.value); - } - } - } - function createIteratorData(data, selector) { - return { current: data.head, selector: selector }; - } - function iteratorNext(data) { - // Navigate to the next entry. - data.current = getNext(data.current); - if (data.current) { - return { value: data.selector(data.current.key, data.current.value), done: false }; - } - else { - return { value: undefined, done: true }; - } - } - /* @internal */ - var ShimCollections; - (function (ShimCollections) { - function createMapShim(getIterator) { - var MapIterator = /** @class */ (function () { - function MapIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - MapIterator.prototype.next = function () { return iteratorNext(this._data); }; - return MapIterator; - }()); - return /** @class */ (function () { - function Map(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (_a) { - var key = _a[0], value = _a[1]; - return _this.set(key, value); - }); - } - Object.defineProperty(Map.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Map.prototype.get = function (key) { var _a; return (_a = getEntry(this._mapData, key)) === null || _a === void 0 ? void 0 : _a.value; }; - Map.prototype.set = function (key, value) { return addOrUpdateEntry(this._mapData, key, value), this; }; - Map.prototype.has = function (key) { return !!getEntry(this._mapData, key); }; - Map.prototype.delete = function (key) { return !!deleteEntry(this._mapData, key); }; - Map.prototype.clear = function () { clearEntries(this._mapData); }; - Map.prototype.keys = function () { return new MapIterator(this._mapData, function (key, _value) { return key; }); }; - Map.prototype.values = function () { return new MapIterator(this._mapData, function (_key, value) { return value; }); }; - Map.prototype.entries = function () { return new MapIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Map.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Map; - }()); - } - ShimCollections.createMapShim = createMapShim; - function createSetShim(getIterator) { - var SetIterator = /** @class */ (function () { - function SetIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - SetIterator.prototype.next = function () { return iteratorNext(this._data); }; - return SetIterator; - }()); - return /** @class */ (function () { - function Set(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (value) { return _this.add(value); }); - } - Object.defineProperty(Set.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Set.prototype.add = function (value) { return addOrUpdateEntry(this._mapData, value, value), this; }; - Set.prototype.has = function (value) { return !!getEntry(this._mapData, value); }; - Set.prototype.delete = function (value) { return !!deleteEntry(this._mapData, value); }; - Set.prototype.clear = function () { clearEntries(this._mapData); }; - Set.prototype.keys = function () { return new SetIterator(this._mapData, function (key, _value) { return key; }); }; - Set.prototype.values = function () { return new SetIterator(this._mapData, function (_key, value) { return value; }); }; - Set.prototype.entries = function () { return new SetIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Set.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Set; - }()); - } - ShimCollections.createSetShim = createSetShim; - })(ShimCollections = ts.ShimCollections || (ts.ShimCollections = {})); -})(ts || (ts = {})); var ts; (function (ts) { // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configurePrerelease` too. - ts.versionMajorMinor = "4.8"; + ts.versionMajorMinor = "4.9"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.8.4"; + ts.version = "".concat(ts.versionMajorMinor, ".3"); /* @internal */ var Comparison; (function (Comparison) { @@ -287422,8 +287227,12 @@ var ts; function tryGetNativeMap() { // Internet Explorer's Map doesn't support iteration, so don't use it. var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - // eslint-disable-next-line no-in-operator - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; /** @@ -287432,24 +287241,19 @@ var ts; function tryGetNativeSet() { // Internet Explorer's Set doesn't support iteration, so don't use it. var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - // eslint-disable-next-line no-in-operator - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); /* @internal */ - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); + ts.Map = NativeCollections.tryGetNativeMap(); /* @internal */ - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); - /* @internal */ - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - // NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it. - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); /* @internal */ var ts; @@ -288165,15 +287969,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -288453,6 +288260,13 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + /** + * Returns the only element of an array if it contains only one element; throws otherwise. + */ + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -289184,8 +288998,8 @@ var ts; return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length); } ts.compareTextSpans = compareTextSpans; - function min(a, b, compare) { - return compare(a, b) === -1 /* Comparison.LessThan */ ? a : b; + function min(items, compare) { + return reduceLeft(items, function (x, y) { return compare(x, y) === -1 /* Comparison.LessThan */ ? x : y; }); } ts.min = min; /** @@ -289976,7 +289790,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -290126,7 +289940,7 @@ var ts; Debug.formatControlFlowGraph = formatControlFlowGraph; var flowNodeProto; function attachFlowNodeDebugInfoWorker(flowNode) { - if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line no-in-operator + if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line local/no-in-operator Object.defineProperties(flowNode, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -290172,7 +289986,7 @@ var ts; Debug.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo; var nodeArrayProto; function attachNodeArrayDebugInfoWorker(array) { - if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line no-in-operator + if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line local/no-in-operator Object.defineProperties(array, { __tsDebuggerDisplay: { value: function (defaultValue) { @@ -290301,7 +290115,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -290498,11 +290312,13 @@ var ts; // > alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers // > MUST NOT include leading zeroes. var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i; + var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i; // https://semver.org/#spec-item-10 // > Build metadata MAY be denoted by appending a plus sign and a series of dot separated // > identifiers immediately following the patch or pre-release version. Identifiers MUST // > comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i; + var buildPartRegExp = /^[a-z0-9-]+$/i; // https://semver.org/#spec-item-9 // > Numeric identifiers MUST NOT include leading zeroes. var numericIdentifierRegExp = /^(0|[1-9]\d*)$/; @@ -290522,13 +290338,15 @@ var ts; ts.Debug.assert(major >= 0, "Invalid argument: major"); ts.Debug.assert(minor >= 0, "Invalid argument: minor"); ts.Debug.assert(patch >= 0, "Invalid argument: patch"); - ts.Debug.assert(!prerelease || prereleaseRegExp.test(prerelease), "Invalid argument: prerelease"); - ts.Debug.assert(!build || buildRegExp.test(build), "Invalid argument: build"); + var prereleaseArray = prerelease ? ts.isArray(prerelease) ? prerelease : prerelease.split(".") : ts.emptyArray; + var buildArray = build ? ts.isArray(build) ? build : build.split(".") : ts.emptyArray; + ts.Debug.assert(ts.every(prereleaseArray, function (s) { return prereleasePartRegExp.test(s); }), "Invalid argument: prerelease"); + ts.Debug.assert(ts.every(buildArray, function (s) { return buildPartRegExp.test(s); }), "Invalid argument: build"); this.major = major; this.minor = minor; this.patch = patch; - this.prerelease = prerelease ? prerelease.split(".") : ts.emptyArray; - this.build = build ? build.split(".") : ts.emptyArray; + this.prerelease = prereleaseArray; + this.build = buildArray; } Version.tryParse = function (text) { var result = tryParseComponents(text); @@ -290567,6 +290385,10 @@ var ts; default: return ts.Debug.assertNever(field); } }; + Version.prototype.with = function (fields) { + var _a = fields.major, major = _a === void 0 ? this.major : _a, _b = fields.minor, minor = _b === void 0 ? this.minor : _b, _c = fields.patch, patch = _c === void 0 ? this.patch : _c, _d = fields.prerelease, prerelease = _d === void 0 ? this.prerelease : _d, _e = fields.build, build = _e === void 0 ? this.build : _e; + return new Version(major, minor, patch, prerelease, build); + }; Version.prototype.toString = function () { var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch); if (ts.some(this.prerelease)) @@ -290575,7 +290397,7 @@ var ts; result += "+".concat(this.build.join(".")); return result; }; - Version.zero = new Version(0, 0, 0); + Version.zero = new Version(0, 0, 0, ["0"]); return Version; }()); ts.Version = Version; @@ -290658,6 +290480,10 @@ var ts; } return undefined; }; + /** + * Tests whether a version matches the range. This is equivalent to `satisfies(version, range, { includePrerelease: true })`. + * in `node-semver`. + */ VersionRange.prototype.test = function (version) { if (typeof version === "string") version = new Version(version); @@ -290768,19 +290594,20 @@ var ts; break; case "<": case ">=": - comparators.push(createComparator(operator, version)); + comparators.push(isWildcard(minor) || isWildcard(patch) ? createComparator(operator, version.with({ prerelease: "0" })) : + createComparator(operator, version)); break; case "<=": case ">": - comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major")) : - isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor")) : + comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major").with({ prerelease: "0" })) : + isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor").with({ prerelease: "0" })) : createComparator(operator, version)); break; case "=": case undefined: if (isWildcard(minor) || isWildcard(patch)) { - comparators.push(createComparator(">=", version)); - comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor"))); + comparators.push(createComparator(">=", version.with({ prerelease: "0" }))); + comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor").with({ prerelease: "0" }))); } else { comparators.push(createComparator("=", version)); @@ -290854,6 +290681,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -290898,7 +290727,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -291031,6 +290862,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; /** * Indicates whether the performance API is enabled. */ @@ -291128,7 +290983,6 @@ var ts; var typeCatalog = []; // NB: id is index + 1 var legendPath; var legend = []; - ; /** Starts tracing for the given project. */ function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); @@ -291333,7 +291187,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -291533,257 +291387,260 @@ var ts; SyntaxKind[SyntaxKind["YieldKeyword"] = 125] = "YieldKeyword"; // Contextual keywords SyntaxKind[SyntaxKind["AbstractKeyword"] = 126] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 127] = "AsKeyword"; - SyntaxKind[SyntaxKind["AssertsKeyword"] = 128] = "AssertsKeyword"; - SyntaxKind[SyntaxKind["AssertKeyword"] = 129] = "AssertKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 130] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 131] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 132] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 133] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 134] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 135] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 136] = "GetKeyword"; - SyntaxKind[SyntaxKind["InferKeyword"] = 137] = "InferKeyword"; - SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 138] = "IntrinsicKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 139] = "IsKeyword"; - SyntaxKind[SyntaxKind["KeyOfKeyword"] = 140] = "KeyOfKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 141] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 142] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 143] = "NeverKeyword"; - SyntaxKind[SyntaxKind["OutKeyword"] = 144] = "OutKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 145] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 146] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 147] = "NumberKeyword"; - SyntaxKind[SyntaxKind["ObjectKeyword"] = 148] = "ObjectKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 149] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 150] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 151] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 152] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 153] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["UniqueKeyword"] = 154] = "UniqueKeyword"; - SyntaxKind[SyntaxKind["UnknownKeyword"] = 155] = "UnknownKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 156] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 157] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["BigIntKeyword"] = 158] = "BigIntKeyword"; - SyntaxKind[SyntaxKind["OverrideKeyword"] = 159] = "OverrideKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 160] = "OfKeyword"; + SyntaxKind[SyntaxKind["AccessorKeyword"] = 127] = "AccessorKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 128] = "AsKeyword"; + SyntaxKind[SyntaxKind["AssertsKeyword"] = 129] = "AssertsKeyword"; + SyntaxKind[SyntaxKind["AssertKeyword"] = 130] = "AssertKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 131] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 132] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 133] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 134] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 135] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 136] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 137] = "GetKeyword"; + SyntaxKind[SyntaxKind["InferKeyword"] = 138] = "InferKeyword"; + SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 140] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 141] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 142] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 143] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 144] = "NeverKeyword"; + SyntaxKind[SyntaxKind["OutKeyword"] = 145] = "OutKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 147] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 148] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 149] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 151] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 152] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 153] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 154] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 155] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["UniqueKeyword"] = 156] = "UniqueKeyword"; + SyntaxKind[SyntaxKind["UnknownKeyword"] = 157] = "UnknownKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 158] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 159] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["BigIntKeyword"] = 160] = "BigIntKeyword"; + SyntaxKind[SyntaxKind["OverrideKeyword"] = 161] = "OverrideKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 162] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 161] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 162] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 163] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 164] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 163] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 164] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 165] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 165] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 166] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 167] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 166] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 167] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 168] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 169] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 170] = "ClassStaticBlockDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 171] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 172] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 173] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 174] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 175] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 176] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 168] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 169] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 170] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 171] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 173] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 174] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 175] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 176] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 177] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 178] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 177] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 178] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 179] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 180] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 181] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 182] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 183] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 184] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 185] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 186] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 187] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 188] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 189] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 190] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 191] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 192] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 193] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 194] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 195] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 196] = "LiteralType"; - SyntaxKind[SyntaxKind["NamedTupleMember"] = 197] = "NamedTupleMember"; - SyntaxKind[SyntaxKind["TemplateLiteralType"] = 198] = "TemplateLiteralType"; - SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 199] = "TemplateLiteralTypeSpan"; - SyntaxKind[SyntaxKind["ImportType"] = 200] = "ImportType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 179] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 180] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 181] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 182] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 183] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 184] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 185] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 186] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 187] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 188] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 189] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 190] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 191] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 192] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 193] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 194] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 195] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 196] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 197] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 198] = "LiteralType"; + SyntaxKind[SyntaxKind["NamedTupleMember"] = 199] = "NamedTupleMember"; + SyntaxKind[SyntaxKind["TemplateLiteralType"] = 200] = "TemplateLiteralType"; + SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; + SyntaxKind[SyntaxKind["ImportType"] = 202] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 201] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 202] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 203] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 205] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 204] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 205] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 206] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 207] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 208] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 209] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 210] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 211] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 212] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 213] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 214] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 215] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 216] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 217] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 218] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 219] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 220] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 221] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 222] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 223] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 224] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 225] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 226] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 227] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 228] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 229] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 230] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 231] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 232] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 209] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 210] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 211] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 215] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 216] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 217] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 218] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 219] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 220] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 223] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 224] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 225] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 226] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 227] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 228] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 229] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 231] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 232] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 233] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 234] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["SatisfiesExpression"] = 235] = "SatisfiesExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 233] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 234] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 236] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 237] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 235] = "Block"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 236] = "EmptyStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 237] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 238] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 239] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 240] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 241] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 242] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 243] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 244] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 245] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 246] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 247] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 248] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 249] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 250] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 251] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 252] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 253] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 254] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 255] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 256] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 257] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 258] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 259] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 260] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 261] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 262] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 263] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 264] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 265] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 266] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 267] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 268] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 269] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 270] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 271] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 272] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 273] = "NamedExports"; - SyntaxKind[SyntaxKind["NamespaceExport"] = 274] = "NamespaceExport"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 275] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 276] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 238] = "Block"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 239] = "EmptyStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 240] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 241] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 242] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 243] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 244] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 245] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 246] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 247] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 248] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 249] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 250] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 251] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 252] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 253] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 254] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 255] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 256] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 257] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 258] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 259] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 260] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 263] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 264] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 265] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 266] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 269] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 270] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 271] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 272] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 273] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 274] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 275] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 276] = "NamedExports"; + SyntaxKind[SyntaxKind["NamespaceExport"] = 277] = "NamespaceExport"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 278] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 279] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 277] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 280] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 278] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 279] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 280] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 281] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 282] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 283] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 284] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 285] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 286] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 287] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 288] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 281] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 283] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 284] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 285] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 287] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 288] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 289] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 291] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 289] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 290] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 291] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 292] = "CatchClause"; - SyntaxKind[SyntaxKind["AssertClause"] = 293] = "AssertClause"; - SyntaxKind[SyntaxKind["AssertEntry"] = 294] = "AssertEntry"; - SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 295] = "ImportTypeAssertionContainer"; + SyntaxKind[SyntaxKind["CaseClause"] = 292] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 293] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 294] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 295] = "CatchClause"; + SyntaxKind[SyntaxKind["AssertClause"] = 296] = "AssertClause"; + SyntaxKind[SyntaxKind["AssertEntry"] = 297] = "AssertEntry"; + SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 296] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 297] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 298] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 299] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 301] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 299] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 302] = "EnumMember"; // Unparsed - SyntaxKind[SyntaxKind["UnparsedPrologue"] = 300] = "UnparsedPrologue"; - SyntaxKind[SyntaxKind["UnparsedPrepend"] = 301] = "UnparsedPrepend"; - SyntaxKind[SyntaxKind["UnparsedText"] = 302] = "UnparsedText"; - SyntaxKind[SyntaxKind["UnparsedInternalText"] = 303] = "UnparsedInternalText"; - SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 304] = "UnparsedSyntheticReference"; + SyntaxKind[SyntaxKind["UnparsedPrologue"] = 303] = "UnparsedPrologue"; + SyntaxKind[SyntaxKind["UnparsedPrepend"] = 304] = "UnparsedPrepend"; + SyntaxKind[SyntaxKind["UnparsedText"] = 305] = "UnparsedText"; + SyntaxKind[SyntaxKind["UnparsedInternalText"] = 306] = "UnparsedInternalText"; + SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 305] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 306] = "Bundle"; - SyntaxKind[SyntaxKind["UnparsedSource"] = 307] = "UnparsedSource"; - SyntaxKind[SyntaxKind["InputFiles"] = 308] = "InputFiles"; + SyntaxKind[SyntaxKind["SourceFile"] = 308] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 309] = "Bundle"; + SyntaxKind[SyntaxKind["UnparsedSource"] = 310] = "UnparsedSource"; + SyntaxKind[SyntaxKind["InputFiles"] = 311] = "InputFiles"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 309] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocNameReference"] = 310] = "JSDocNameReference"; - SyntaxKind[SyntaxKind["JSDocMemberName"] = 311] = "JSDocMemberName"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 312] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 313] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 314] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 315] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 316] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType"; - SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocNameReference"] = 313] = "JSDocNameReference"; + SyntaxKind[SyntaxKind["JSDocMemberName"] = 314] = "JSDocMemberName"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 315] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 316] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 317] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 319] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 320] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 321] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocNamepathType"] = 322] = "JSDocNamepathType"; + SyntaxKind[SyntaxKind["JSDoc"] = 323] = "JSDoc"; /** @deprecated Use SyntaxKind.JSDoc */ - SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 322] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 323] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocLink"] = 324] = "JSDocLink"; - SyntaxKind[SyntaxKind["JSDocLinkCode"] = 325] = "JSDocLinkCode"; - SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 326] = "JSDocLinkPlain"; - SyntaxKind[SyntaxKind["JSDocTag"] = 327] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 328] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 329] = "JSDocImplementsTag"; - SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 330] = "JSDocAuthorTag"; - SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 331] = "JSDocDeprecatedTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 332] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocPublicTag"] = 333] = "JSDocPublicTag"; - SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 334] = "JSDocPrivateTag"; - SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 335] = "JSDocProtectedTag"; - SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 336] = "JSDocReadonlyTag"; - SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 337] = "JSDocOverrideTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 338] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocEnumTag"] = 339] = "JSDocEnumTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 340] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 341] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 342] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 343] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 344] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 345] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocSeeTag"] = 346] = "JSDocSeeTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 347] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocComment"] = 323] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocText"] = 324] = "JSDocText"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 326] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocLink"] = 327] = "JSDocLink"; + SyntaxKind[SyntaxKind["JSDocLinkCode"] = 328] = "JSDocLinkCode"; + SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; + SyntaxKind[SyntaxKind["JSDocTag"] = 330] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; + SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; + SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 335] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocPublicTag"] = 336] = "JSDocPublicTag"; + SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; + SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; + SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; + SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocEnumTag"] = 342] = "JSDocEnumTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 343] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 344] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 345] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 346] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 347] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 348] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocSeeTag"] = 349] = "JSDocSeeTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 350] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 348] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 351] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 351] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 352] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 353] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 354] = "SyntheticReferenceExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 352] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 354] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 355] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 356] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 355] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 358] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment"; @@ -291792,15 +291649,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 81] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 116] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 81] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 160] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 162] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 117] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 125] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 177] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 200] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 179] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 202] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 78] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 160] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 162] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -291809,15 +291666,15 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 78] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstStatement"] = 237] = "FirstStatement"; - SyntaxKind[SyntaxKind["LastStatement"] = 253] = "LastStatement"; - SyntaxKind[SyntaxKind["FirstNode"] = 161] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 309] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 347] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 327] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstStatement"] = 240] = "FirstStatement"; + SyntaxKind[SyntaxKind["LastStatement"] = 256] = "LastStatement"; + SyntaxKind[SyntaxKind["FirstNode"] = 163] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 312] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 350] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 330] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 350] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword"; - /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 162] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -291882,9 +291739,10 @@ var ts; ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; - ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; - ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; - ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Accessor"] = 128] = "Accessor"; + ModifierFlags[ModifierFlags["Abstract"] = 256] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 512] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 1024] = "Default"; ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; ModifierFlags[ModifierFlags["HasComputedJSDocModifiers"] = 4096] = "HasComputedJSDocModifiers"; ModifierFlags[ModifierFlags["Deprecated"] = 8192] = "Deprecated"; @@ -291897,10 +291755,10 @@ var ts; // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 16476] = "ParameterPropertyModifier"; ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; - ModifierFlags[ModifierFlags["TypeScriptModifier"] = 116958] = "TypeScriptModifier"; - ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; - ModifierFlags[ModifierFlags["All"] = 257023] = "All"; - ModifierFlags[ModifierFlags["Modifier"] = 125951] = "Modifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 117086] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 1025] = "ExportDefault"; + ModifierFlags[ModifierFlags["All"] = 258047] = "All"; + ModifierFlags[ModifierFlags["Modifier"] = 126975] = "Modifier"; })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); var JsxFlags; (function (JsxFlags) { @@ -292096,6 +291954,7 @@ var ts; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple"; NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType"; + /* @internal */ NodeBuilderFlags[NodeBuilderFlags["WriteComputedProps"] = 1073741824] = "WriteComputedProps"; // Errors (cont.) NodeBuilderFlags[NodeBuilderFlags["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths"; /* @internal */ NodeBuilderFlags[NodeBuilderFlags["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain"; @@ -292156,8 +292015,10 @@ var ts; SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind"; // Prefer aliases which are not directly visible SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope"; + // { [E.A]: 1 } + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["WriteComputedProps"] = 16] = "WriteComputedProps"; // Skip building an accessible symbol chain - /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 16] = "DoNotIncludeSymbolChain"; + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 32] = "DoNotIncludeSymbolChain"; })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); /* @internal */ var SymbolAccessibility; @@ -292271,6 +292132,7 @@ var ts; SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes"; SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["AccessorExcludes"] = 13247] = "AccessorExcludes"; SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes"; SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes"; SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes"; @@ -292354,8 +292216,8 @@ var ts; NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; - NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper"; - NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding"; + NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync"; + NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync"; NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments"; NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed"; NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass"; @@ -293397,7 +293259,6 @@ var ts; var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); /* @internal */ ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels); - /* @internal */ function setCustomPollingValues(system) { if (!system.getEnvironmentVariable) { return; @@ -293440,7 +293301,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; // Max visit would be all elements of the queue @@ -293486,7 +293346,6 @@ var ts; } } } - /* @internal */ function createDynamicPriorityPollingWatchFile(host) { var watchedFiles = []; var changedFilesInLastPoll = []; @@ -293595,7 +293454,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { // One file can have multiple watchers var fileWatcherCallbacks = ts.createMultiMap(); @@ -293674,42 +293532,38 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - /* @internal */ - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; - } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher(( + // Cant infer types correctly so lets satisfy checker + function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + // Watcher is not expected to be undefined, but if it is normally its because + // exception was thrown somewhere else and watch state is not what it should be + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; /** * Returns true if file status changed */ - /*@internal*/ function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -293721,7 +293575,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; /*@internal*/ function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 @@ -293749,7 +293602,6 @@ var ts; * that means if this is recursive watcher, watch the children directories as well * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile) */ - /*@internal*/ function createDirectoryWatcherSupportingRecursive(_a) { var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout; var cache = new ts.Map(); @@ -293958,18 +293810,15 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; /*@internal*/ var FileSystemEntryKind; (function (FileSystemEntryKind) { FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {})); - /*@internal*/ function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -294003,7 +293852,10 @@ var ts; } /*@internal*/ function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -294066,8 +293918,8 @@ var ts; return useNonPollingWatchers ? // Use notifications from FS to watch with falling back to fs.watchFile generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : - // Default to do not use fixed polling interval - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + // Default to using fs events + { watchFile: ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -294138,7 +293990,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -294317,7 +294175,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -294333,7 +294191,6 @@ var ts; tscWatchFile: process.env.TSC_WATCHFILE, useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER, tscWatchDirectory: process.env.TSC_WATCHDIRECTORY, - defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; @@ -295137,12 +294994,9 @@ var ts; * Normalize path separators, converting `\` into `/`. */ function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; // prime regex with known position - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; /** @@ -295725,6 +295579,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -295775,7 +295631,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -295783,6 +295639,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -295956,14 +295813,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -296206,6 +296061,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -296386,6 +296242,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -296843,6 +296700,11 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), + Resolving_in_0_mode_with_conditions_1: diag(6402, ts.DiagnosticCategory.Message, "Resolving_in_0_mode_with_conditions_1_6402", "Resolving in {0} mode with conditions {1}."), + Matched_0_condition_1: diag(6403, ts.DiagnosticCategory.Message, "Matched_0_condition_1_6403", "Matched '{0}' condition '{1}'."), + Using_0_subpath_1_with_target_2: diag(6404, ts.DiagnosticCategory.Message, "Using_0_subpath_1_with_target_2_6404", "Using '{0}' subpath '{1}' with target '{2}'."), + Saw_non_matching_condition_0: diag(6405, ts.DiagnosticCategory.Message, "Saw_non_matching_condition_0_6405", "Saw non-matching condition '{0}'."), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -297085,6 +296947,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -297158,6 +297021,8 @@ var ts; Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""), Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""), Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""), + Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"), + Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"), Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"), Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"), Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"), @@ -297256,6 +297121,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -297325,6 +297191,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -297358,6 +297226,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -297376,12 +297250,13 @@ var ts; /** @internal */ ts.textToKeywordObj = (_a = { abstract: 126 /* SyntaxKind.AbstractKeyword */, - any: 130 /* SyntaxKind.AnyKeyword */, - as: 127 /* SyntaxKind.AsKeyword */, - asserts: 128 /* SyntaxKind.AssertsKeyword */, - assert: 129 /* SyntaxKind.AssertKeyword */, - bigint: 158 /* SyntaxKind.BigIntKeyword */, - boolean: 133 /* SyntaxKind.BooleanKeyword */, + accessor: 127 /* SyntaxKind.AccessorKeyword */, + any: 131 /* SyntaxKind.AnyKeyword */, + as: 128 /* SyntaxKind.AsKeyword */, + asserts: 129 /* SyntaxKind.AssertsKeyword */, + assert: 130 /* SyntaxKind.AssertKeyword */, + bigint: 160 /* SyntaxKind.BigIntKeyword */, + boolean: 134 /* SyntaxKind.BooleanKeyword */, break: 81 /* SyntaxKind.BreakKeyword */, case: 82 /* SyntaxKind.CaseKeyword */, catch: 83 /* SyntaxKind.CatchKeyword */, @@ -297389,9 +297264,9 @@ var ts; continue: 86 /* SyntaxKind.ContinueKeyword */, const: 85 /* SyntaxKind.ConstKeyword */ }, - _a["" + "constructor"] = 134 /* SyntaxKind.ConstructorKeyword */, + _a["" + "constructor"] = 135 /* SyntaxKind.ConstructorKeyword */, _a.debugger = 87 /* SyntaxKind.DebuggerKeyword */, - _a.declare = 135 /* SyntaxKind.DeclareKeyword */, + _a.declare = 136 /* SyntaxKind.DeclareKeyword */, _a.default = 88 /* SyntaxKind.DefaultKeyword */, _a.delete = 89 /* SyntaxKind.DeleteKeyword */, _a.do = 90 /* SyntaxKind.DoKeyword */, @@ -297402,60 +297277,61 @@ var ts; _a.false = 95 /* SyntaxKind.FalseKeyword */, _a.finally = 96 /* SyntaxKind.FinallyKeyword */, _a.for = 97 /* SyntaxKind.ForKeyword */, - _a.from = 156 /* SyntaxKind.FromKeyword */, + _a.from = 158 /* SyntaxKind.FromKeyword */, _a.function = 98 /* SyntaxKind.FunctionKeyword */, - _a.get = 136 /* SyntaxKind.GetKeyword */, + _a.get = 137 /* SyntaxKind.GetKeyword */, _a.if = 99 /* SyntaxKind.IfKeyword */, _a.implements = 117 /* SyntaxKind.ImplementsKeyword */, _a.import = 100 /* SyntaxKind.ImportKeyword */, _a.in = 101 /* SyntaxKind.InKeyword */, - _a.infer = 137 /* SyntaxKind.InferKeyword */, + _a.infer = 138 /* SyntaxKind.InferKeyword */, _a.instanceof = 102 /* SyntaxKind.InstanceOfKeyword */, _a.interface = 118 /* SyntaxKind.InterfaceKeyword */, - _a.intrinsic = 138 /* SyntaxKind.IntrinsicKeyword */, - _a.is = 139 /* SyntaxKind.IsKeyword */, - _a.keyof = 140 /* SyntaxKind.KeyOfKeyword */, + _a.intrinsic = 139 /* SyntaxKind.IntrinsicKeyword */, + _a.is = 140 /* SyntaxKind.IsKeyword */, + _a.keyof = 141 /* SyntaxKind.KeyOfKeyword */, _a.let = 119 /* SyntaxKind.LetKeyword */, - _a.module = 141 /* SyntaxKind.ModuleKeyword */, - _a.namespace = 142 /* SyntaxKind.NamespaceKeyword */, - _a.never = 143 /* SyntaxKind.NeverKeyword */, + _a.module = 142 /* SyntaxKind.ModuleKeyword */, + _a.namespace = 143 /* SyntaxKind.NamespaceKeyword */, + _a.never = 144 /* SyntaxKind.NeverKeyword */, _a.new = 103 /* SyntaxKind.NewKeyword */, _a.null = 104 /* SyntaxKind.NullKeyword */, - _a.number = 147 /* SyntaxKind.NumberKeyword */, - _a.object = 148 /* SyntaxKind.ObjectKeyword */, + _a.number = 148 /* SyntaxKind.NumberKeyword */, + _a.object = 149 /* SyntaxKind.ObjectKeyword */, _a.package = 120 /* SyntaxKind.PackageKeyword */, _a.private = 121 /* SyntaxKind.PrivateKeyword */, _a.protected = 122 /* SyntaxKind.ProtectedKeyword */, _a.public = 123 /* SyntaxKind.PublicKeyword */, - _a.override = 159 /* SyntaxKind.OverrideKeyword */, - _a.out = 144 /* SyntaxKind.OutKeyword */, - _a.readonly = 145 /* SyntaxKind.ReadonlyKeyword */, - _a.require = 146 /* SyntaxKind.RequireKeyword */, - _a.global = 157 /* SyntaxKind.GlobalKeyword */, + _a.override = 161 /* SyntaxKind.OverrideKeyword */, + _a.out = 145 /* SyntaxKind.OutKeyword */, + _a.readonly = 146 /* SyntaxKind.ReadonlyKeyword */, + _a.require = 147 /* SyntaxKind.RequireKeyword */, + _a.global = 159 /* SyntaxKind.GlobalKeyword */, _a.return = 105 /* SyntaxKind.ReturnKeyword */, - _a.set = 149 /* SyntaxKind.SetKeyword */, + _a.satisfies = 150 /* SyntaxKind.SatisfiesKeyword */, + _a.set = 151 /* SyntaxKind.SetKeyword */, _a.static = 124 /* SyntaxKind.StaticKeyword */, - _a.string = 150 /* SyntaxKind.StringKeyword */, + _a.string = 152 /* SyntaxKind.StringKeyword */, _a.super = 106 /* SyntaxKind.SuperKeyword */, _a.switch = 107 /* SyntaxKind.SwitchKeyword */, - _a.symbol = 151 /* SyntaxKind.SymbolKeyword */, + _a.symbol = 153 /* SyntaxKind.SymbolKeyword */, _a.this = 108 /* SyntaxKind.ThisKeyword */, _a.throw = 109 /* SyntaxKind.ThrowKeyword */, _a.true = 110 /* SyntaxKind.TrueKeyword */, _a.try = 111 /* SyntaxKind.TryKeyword */, - _a.type = 152 /* SyntaxKind.TypeKeyword */, + _a.type = 154 /* SyntaxKind.TypeKeyword */, _a.typeof = 112 /* SyntaxKind.TypeOfKeyword */, - _a.undefined = 153 /* SyntaxKind.UndefinedKeyword */, - _a.unique = 154 /* SyntaxKind.UniqueKeyword */, - _a.unknown = 155 /* SyntaxKind.UnknownKeyword */, + _a.undefined = 155 /* SyntaxKind.UndefinedKeyword */, + _a.unique = 156 /* SyntaxKind.UniqueKeyword */, + _a.unknown = 157 /* SyntaxKind.UnknownKeyword */, _a.var = 113 /* SyntaxKind.VarKeyword */, _a.void = 114 /* SyntaxKind.VoidKeyword */, _a.while = 115 /* SyntaxKind.WhileKeyword */, _a.with = 116 /* SyntaxKind.WithKeyword */, _a.yield = 125 /* SyntaxKind.YieldKeyword */, - _a.async = 131 /* SyntaxKind.AsyncKeyword */, - _a.await = 132 /* SyntaxKind.AwaitKeyword */, - _a.of = 160 /* SyntaxKind.OfKeyword */, + _a.async = 132 /* SyntaxKind.AsyncKeyword */, + _a.await = 133 /* SyntaxKind.AwaitKeyword */, + _a.of = 162 /* SyntaxKind.OfKeyword */, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18 /* SyntaxKind.OpenBraceToken */, "}": 19 /* SyntaxKind.CloseBraceToken */, "(": 20 /* SyntaxKind.OpenParenToken */, ")": 21 /* SyntaxKind.CloseParenToken */, "[": 22 /* SyntaxKind.OpenBracketToken */, "]": 23 /* SyntaxKind.CloseBracketToken */, ".": 24 /* SyntaxKind.DotToken */, "...": 25 /* SyntaxKind.DotDotDotToken */, ";": 26 /* SyntaxKind.SemicolonToken */, ",": 27 /* SyntaxKind.CommaToken */, "<": 29 /* SyntaxKind.LessThanToken */, ">": 31 /* SyntaxKind.GreaterThanToken */, "<=": 32 /* SyntaxKind.LessThanEqualsToken */, ">=": 33 /* SyntaxKind.GreaterThanEqualsToken */, "==": 34 /* SyntaxKind.EqualsEqualsToken */, "!=": 35 /* SyntaxKind.ExclamationEqualsToken */, "===": 36 /* SyntaxKind.EqualsEqualsEqualsToken */, "!==": 37 /* SyntaxKind.ExclamationEqualsEqualsToken */, "=>": 38 /* SyntaxKind.EqualsGreaterThanToken */, "+": 39 /* SyntaxKind.PlusToken */, "-": 40 /* SyntaxKind.MinusToken */, "**": 42 /* SyntaxKind.AsteriskAsteriskToken */, "*": 41 /* SyntaxKind.AsteriskToken */, "/": 43 /* SyntaxKind.SlashToken */, "%": 44 /* SyntaxKind.PercentToken */, "++": 45 /* SyntaxKind.PlusPlusToken */, "--": 46 /* SyntaxKind.MinusMinusToken */, "<<": 47 /* SyntaxKind.LessThanLessThanToken */, ">": 48 /* SyntaxKind.GreaterThanGreaterThanToken */, ">>>": 49 /* SyntaxKind.GreaterThanGreaterThanGreaterThanToken */, "&": 50 /* SyntaxKind.AmpersandToken */, "|": 51 /* SyntaxKind.BarToken */, "^": 52 /* SyntaxKind.CaretToken */, "!": 53 /* SyntaxKind.ExclamationToken */, "~": 54 /* SyntaxKind.TildeToken */, "&&": 55 /* SyntaxKind.AmpersandAmpersandToken */, "||": 56 /* SyntaxKind.BarBarToken */, "?": 57 /* SyntaxKind.QuestionToken */, "??": 60 /* SyntaxKind.QuestionQuestionToken */, "?.": 28 /* SyntaxKind.QuestionDotToken */, ":": 58 /* SyntaxKind.ColonToken */, "=": 63 /* SyntaxKind.EqualsToken */, "+=": 64 /* SyntaxKind.PlusEqualsToken */, "-=": 65 /* SyntaxKind.MinusEqualsToken */, "*=": 66 /* SyntaxKind.AsteriskEqualsToken */, "**=": 67 /* SyntaxKind.AsteriskAsteriskEqualsToken */, "/=": 68 /* SyntaxKind.SlashEqualsToken */, "%=": 69 /* SyntaxKind.PercentEqualsToken */, "<<=": 70 /* SyntaxKind.LessThanLessThanEqualsToken */, ">>=": 71 /* SyntaxKind.GreaterThanGreaterThanEqualsToken */, ">>>=": 72 /* SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 73 /* SyntaxKind.AmpersandEqualsToken */, "|=": 74 /* SyntaxKind.BarEqualsToken */, "^=": 78 /* SyntaxKind.CaretEqualsToken */, "||=": 75 /* SyntaxKind.BarBarEqualsToken */, "&&=": 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */, "??=": 77 /* SyntaxKind.QuestionQuestionEqualsToken */, "@": 59 /* SyntaxKind.AtToken */, "#": 62 /* SyntaxKind.HashToken */, "`": 61 /* SyntaxKind.BacktickToken */ }))); @@ -297578,7 +297454,7 @@ var ts; ts.stringToToken = stringToToken; /* @internal */ function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -298604,7 +298480,7 @@ var ts; return -1; } function peekExtendedUnicodeEscape() { - if (languageVersion >= 2 /* ScriptTarget.ES2015 */ && codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) { + if (codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) { var start_2 = pos; pos += 3; var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false); @@ -299139,12 +299015,36 @@ var ts; pos++; return token = 0 /* SyntaxKind.Unknown */; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92 /* CharacterCodes.backslash */) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { + pos++; + // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact. + // Notably absent from this block is the fact that calling a function named "scanIdentifier", + // but identifiers don't include '#', and that function doesn't deal with it at all. + // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings; + // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us. + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80 /* SyntaxKind.PrivateIdentifier */; @@ -299895,9 +299795,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163 /* SyntaxKind.TypeParameter */) { + if (d && d.kind === 165 /* SyntaxKind.TypeParameter */) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return current; } } @@ -299905,7 +299805,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 171 /* SyntaxKind.Constructor */; + return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 173 /* SyntaxKind.Constructor */; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -299935,14 +299835,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node && node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237 /* SyntaxKind.VariableStatement */) { + if (node && node.kind === 240 /* SyntaxKind.VariableStatement */) { flags |= getFlags(node); } return flags; @@ -300115,30 +300015,30 @@ var ts; } // Covers remaining cases (returning undefined if none match). switch (hostNode.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: var expr = hostNode.expression; - if (expr.kind === 221 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (expr.kind === 223 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return expr.name; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -300175,16 +300075,16 @@ var ts; switch (declaration.kind) { case 79 /* SyntaxKind.Identifier */: return declaration; - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: { var name = declaration.name; - if (name.kind === 161 /* SyntaxKind.QualifiedName */) { + if (name.kind === 163 /* SyntaxKind.QualifiedName */) { return name.right; } break; } - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -300200,15 +300100,15 @@ var ts; return undefined; } } - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 339 /* SyntaxKind.JSDocEnumTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -300252,7 +300152,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951 /* ModifierFlags.Modifier */)) { + if (ts.hasSyntacticModifier(node, 126975 /* ModifierFlags.Modifier */)) { return ts.filter(node.modifiers, isModifier); } } @@ -300513,12 +300413,12 @@ var ts; /** Gets the text of a jsdoc comment, flattening links to their text. */ function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 /* SyntaxKind.JSDocLink */ ? "link" - : link.kind === 325 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" + var kind = link.kind === 327 /* SyntaxKind.JSDocLink */ ? "link" + : link.kind === 328 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -300539,7 +300439,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDoc */); + ts.Debug.assert(node.parent.kind === 323 /* SyntaxKind.JSDoc */); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -300574,7 +300474,7 @@ var ts; ts.isMemberName = isMemberName; /* @internal */ function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */ || node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */ || node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -300592,10 +300492,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32 /* NodeFlags.OptionalChain */) && - (kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 207 /* SyntaxKind.ElementAccessExpression */ - || kind === 208 /* SyntaxKind.CallExpression */ - || kind === 230 /* SyntaxKind.NonNullExpression */); + (kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 209 /* SyntaxKind.ElementAccessExpression */ + || kind === 210 /* SyntaxKind.CallExpression */ + || kind === 232 /* SyntaxKind.NonNullExpression */); } ts.isOptionalChain = isOptionalChain; /* @internal */ @@ -300630,7 +300530,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -300647,17 +300547,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */ || node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */ || node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return true; default: return false; @@ -300666,12 +300566,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 /* SyntaxKind.UnparsedPrologue */ || - node.kind === 304 /* SyntaxKind.UnparsedSyntheticReference */; + node.kind === 303 /* SyntaxKind.UnparsedPrologue */ || + node.kind === 307 /* SyntaxKind.UnparsedSyntheticReference */; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; // #endregion @@ -300687,7 +300587,7 @@ var ts; ts.isNode = isNode; /* @internal */ function isNodeKind(kind) { - return kind >= 161 /* SyntaxKind.FirstNode */; + return kind >= 163 /* SyntaxKind.FirstNode */; } ts.isNodeKind = isNodeKind; /** @@ -300696,7 +300596,7 @@ var ts; * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isTokenKind(kind) { - return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */; + return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 162 /* SyntaxKind.LastToken */; } ts.isTokenKind = isTokenKind; /** @@ -300711,7 +300611,7 @@ var ts; // Node Arrays /* @internal */ function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; // Literals @@ -300727,11 +300627,11 @@ var ts; /** @internal */ function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; } return false; @@ -300759,13 +300659,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.isTypeOnly; - case 267 /* SyntaxKind.ImportClause */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.isTypeOnly; default: return false; @@ -300786,6 +300686,11 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + /* @internal */ + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; // Private Identifiers /*@internal*/ function isPrivateIdentifierClassElementDeclaration(node) { @@ -300802,19 +300707,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 101 /* SyntaxKind.InKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; } return false; @@ -300827,7 +300733,10 @@ var ts; ts.isParameterPropertyModifier = isParameterPropertyModifier; /* @internal */ function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 /* SyntaxKind.StaticKeyword */ || idToken === 159 /* SyntaxKind.OverrideKeyword */; + return isParameterPropertyModifier(idToken) || + idToken === 124 /* SyntaxKind.StaticKeyword */ || + idToken === 161 /* SyntaxKind.OverrideKeyword */ || + idToken === 127 /* SyntaxKind.AccessorKeyword */; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -300836,7 +300745,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isEntityName = isEntityName; @@ -300846,14 +300755,14 @@ var ts; || kind === 80 /* SyntaxKind.PrivateIdentifier */ || kind === 10 /* SyntaxKind.StringLiteral */ || kind === 8 /* SyntaxKind.NumericLiteral */ - || kind === 162 /* SyntaxKind.ComputedPropertyName */; + || kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */ - || kind === 202 /* SyntaxKind.ArrayBindingPattern */; + || kind === 203 /* SyntaxKind.ObjectBindingPattern */ + || kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -300878,13 +300787,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -300893,14 +300802,14 @@ var ts; /* @internal */ function isFunctionLikeKind(kind) { switch (kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -300915,36 +300824,53 @@ var ts; // Classes function isClassElement(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 234 /* SyntaxKind.SemicolonClassElement */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */); + return node && (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */); + return node && (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; /* @internal */ function isMethodOrAccessor(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + /* @internal */ + function isNamedClassElement(node) { + switch (node.kind) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; // Type members function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); @@ -300952,13 +300878,13 @@ var ts; ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 174 /* SyntaxKind.CallSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 176 /* SyntaxKind.CallSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -300967,12 +300893,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 298 /* SyntaxKind.SpreadAssignment */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 301 /* SyntaxKind.SpreadAssignment */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -300987,8 +300913,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; } return false; @@ -300999,8 +300925,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 /* SyntaxKind.ArrayBindingPattern */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return kind === 204 /* SyntaxKind.ArrayBindingPattern */ + || kind === 203 /* SyntaxKind.ObjectBindingPattern */; } return false; } @@ -301008,15 +300934,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 /* SyntaxKind.ArrayLiteralExpression */ - || kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return kind === 206 /* SyntaxKind.ArrayLiteralExpression */ + || kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 /* SyntaxKind.BindingElement */ - || kind === 227 /* SyntaxKind.OmittedExpression */; + return kind === 205 /* SyntaxKind.BindingElement */ + || kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -301025,9 +300951,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: return true; } return false; @@ -301048,8 +300974,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return true; } return false; @@ -301058,10 +300984,10 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty - case 298 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty + case 301 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty return true; } return false; @@ -301073,8 +300999,8 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; } return false; @@ -301083,26 +301009,26 @@ var ts; /* @internal */ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */ - || kind === 200 /* SyntaxKind.ImportType */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */ + || kind === 202 /* SyntaxKind.ImportType */; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: return true; default: return false; @@ -301110,12 +301036,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */ || node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */ || node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 /* SyntaxKind.TemplateExpression */ + return kind === 225 /* SyntaxKind.TemplateExpression */ || kind === 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -301126,19 +301052,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: // technically this is only an Expression if it's in a `#field in expr` BinaryExpression case 13 /* SyntaxKind.RegularExpressionLiteral */: @@ -301146,15 +301072,15 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 230 /* SyntaxKind.NonNullExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 231 /* SyntaxKind.MetaProperty */: + case 232 /* SyntaxKind.NonNullExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 233 /* SyntaxKind.MetaProperty */: case 100 /* SyntaxKind.ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -301168,13 +301094,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -301183,9 +301109,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; default: @@ -301204,15 +301130,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 221 /* SyntaxKind.BinaryExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 229 /* SyntaxKind.AsExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 223 /* SyntaxKind.BinaryExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 231 /* SyntaxKind.AsExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -301220,8 +301147,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 /* SyntaxKind.TypeAssertionExpression */ - || kind === 229 /* SyntaxKind.AsExpression */; + return kind === 213 /* SyntaxKind.TypeAssertionExpression */ + || kind === 231 /* SyntaxKind.AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ @@ -301232,13 +301159,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -301267,7 +301194,7 @@ var ts; ts.isExternalModuleIndicator = isExternalModuleIndicator; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */ || node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */ || node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -301291,115 +301218,115 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 /* SyntaxKind.NamedImports */ - || kind === 268 /* SyntaxKind.NamespaceImport */; + return kind === 272 /* SyntaxKind.NamedImports */ + || kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 203 /* SyntaxKind.BindingElement */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 299 /* SyntaxKind.EnumMember */ - || kind === 275 /* SyntaxKind.ExportSpecifier */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 267 /* SyntaxKind.ImportClause */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 270 /* SyntaxKind.ImportSpecifier */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 268 /* SyntaxKind.NamespaceImport */ - || kind === 274 /* SyntaxKind.NamespaceExport */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 254 /* SyntaxKind.VariableDeclaration */ - || kind === 345 /* SyntaxKind.JSDocTypedefTag */ - || kind === 338 /* SyntaxKind.JSDocCallbackTag */ - || kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 205 /* SyntaxKind.BindingElement */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 302 /* SyntaxKind.EnumMember */ + || kind === 278 /* SyntaxKind.ExportSpecifier */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 270 /* SyntaxKind.ImportClause */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 273 /* SyntaxKind.ImportSpecifier */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 271 /* SyntaxKind.NamespaceImport */ + || kind === 277 /* SyntaxKind.NamespaceExport */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 257 /* SyntaxKind.VariableDeclaration */ + || kind === 348 /* SyntaxKind.JSDocTypedefTag */ + || kind === 341 /* SyntaxKind.JSDocCallbackTag */ + || kind === 350 /* SyntaxKind.JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 236 /* SyntaxKind.EmptyStatement */ - || kind === 243 /* SyntaxKind.ForInStatement */ - || kind === 244 /* SyntaxKind.ForOfStatement */ - || kind === 242 /* SyntaxKind.ForStatement */ - || kind === 239 /* SyntaxKind.IfStatement */ - || kind === 250 /* SyntaxKind.LabeledStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 249 /* SyntaxKind.SwitchStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 252 /* SyntaxKind.TryStatement */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 241 /* SyntaxKind.WhileStatement */ - || kind === 248 /* SyntaxKind.WithStatement */ - || kind === 349 /* SyntaxKind.NotEmittedStatement */ - || kind === 353 /* SyntaxKind.EndOfDeclarationMarker */ - || kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 239 /* SyntaxKind.EmptyStatement */ + || kind === 246 /* SyntaxKind.ForInStatement */ + || kind === 247 /* SyntaxKind.ForOfStatement */ + || kind === 245 /* SyntaxKind.ForStatement */ + || kind === 242 /* SyntaxKind.IfStatement */ + || kind === 253 /* SyntaxKind.LabeledStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 252 /* SyntaxKind.SwitchStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 255 /* SyntaxKind.TryStatement */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 244 /* SyntaxKind.WhileStatement */ + || kind === 251 /* SyntaxKind.WithStatement */ + || kind === 352 /* SyntaxKind.NotEmittedStatement */ + || kind === 356 /* SyntaxKind.EndOfDeclarationMarker */ + || kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { - return (node.parent && node.parent.kind !== 344 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { + return (node.parent && node.parent.kind !== 347 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -301426,10 +301353,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235 /* SyntaxKind.Block */) + if (node.kind !== 238 /* SyntaxKind.Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 /* SyntaxKind.TryStatement */ || node.parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (node.parent.kind === 255 /* SyntaxKind.TryStatement */ || node.parent.kind === 295 /* SyntaxKind.CatchClause */) { return false; } } @@ -301443,15 +301370,15 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235 /* SyntaxKind.Block */; + || kind === 238 /* SyntaxKind.Block */; } ts.isStatementOrBlock = isStatementOrBlock; // Module references /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 277 /* SyntaxKind.ExternalModuleReference */ - || kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 280 /* SyntaxKind.ExternalModuleReference */ + || kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleReference = isModuleReference; @@ -301461,58 +301388,58 @@ var ts; var kind = node.kind; return kind === 108 /* SyntaxKind.ThisKeyword */ || kind === 79 /* SyntaxKind.Identifier */ - || kind === 206 /* SyntaxKind.PropertyAccessExpression */; + || kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 278 /* SyntaxKind.JsxElement */ - || kind === 288 /* SyntaxKind.JsxExpression */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */ + return kind === 281 /* SyntaxKind.JsxElement */ + || kind === 291 /* SyntaxKind.JsxExpression */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || kind === 11 /* SyntaxKind.JsxText */ - || kind === 282 /* SyntaxKind.JsxFragment */; + || kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 /* SyntaxKind.StringLiteral */ - || kind === 288 /* SyntaxKind.JsxExpression */; + || kind === 291 /* SyntaxKind.JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 /* SyntaxKind.JsxOpeningElement */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return kind === 283 /* SyntaxKind.JsxOpeningElement */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 /* SyntaxKind.CaseClause */ - || kind === 290 /* SyntaxKind.DefaultClause */; + return kind === 292 /* SyntaxKind.CaseClause */ + || kind === 293 /* SyntaxKind.DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 309 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocNode */; + return node.kind >= 312 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */ - || node.kind === 319 /* SyntaxKind.JSDocNamepathType */ - || node.kind === 321 /* SyntaxKind.JSDocText */ + return node.kind === 323 /* SyntaxKind.JSDoc */ + || node.kind === 322 /* SyntaxKind.JSDocNamepathType */ + || node.kind === 324 /* SyntaxKind.JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -301522,15 +301449,15 @@ var ts; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 327 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocTagNode */; + return node.kind >= 330 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessor = isGetAccessor; /** True if has jsdoc nodes attached to it. */ @@ -301556,12 +301483,12 @@ var ts; /** True if has initializer node attached to it. */ function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: return true; default: return false; @@ -301569,12 +301496,12 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */ || node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 288 /* SyntaxKind.JsxAttribute */ || node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -301607,7 +301534,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */ || node.kind === 325 /* SyntaxKind.JSDocLinkCode */ || node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 327 /* SyntaxKind.JSDocLink */ || node.kind === 328 /* SyntaxKind.JSDocLinkCode */ || node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -301617,7 +301544,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isRestParameter = isRestParameter; // #endregion @@ -301875,7 +301802,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + while (node && node.kind !== 308 /* SyntaxKind.SourceFile */) { node = node.parent; } return node; @@ -301891,11 +301818,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return true; } return false; @@ -302091,7 +302018,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 348 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { + if (node.kind === 351 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, @@ -302156,7 +302083,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -302329,7 +302255,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -302361,11 +302287,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return !!node && node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && (!node.body); + return !!node && node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || + return node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -302382,9 +302308,9 @@ var ts; // - defined in the top level scope and source file is an external module // - defined inside ambient module declaration located in the top level scope and source file not an external module switch (node.parent.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node.parent); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -302439,26 +302365,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216 /* NodeFlags.Ambient */) || hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 292 /* SyntaxKind.CatchClause */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); @@ -302468,9 +302398,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 323 /* SyntaxKind.JSDocSignature */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 326 /* SyntaxKind.JSDocSignature */: return true; default: ts.assertType(node); @@ -302480,25 +302410,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: ts.assertType(node); @@ -302508,8 +302438,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -302522,15 +302452,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return true; default: return false; @@ -302571,19 +302501,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -302603,16 +302533,16 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: case 79 /* SyntaxKind.Identifier */: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311 /* SyntaxKind.JSDocMemberName */: + case 314 /* SyntaxKind.JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -302702,7 +302632,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body && node.body.kind === 238 /* SyntaxKind.Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -302716,7 +302646,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -302725,29 +302655,29 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 268 /* SyntaxKind.NamespaceImport */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 271 /* SyntaxKind.NamespaceImport */: errorNode = node.name; break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -302799,11 +302729,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -302817,7 +302747,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */ + return node.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.expression.kind === 10 /* SyntaxKind.StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -302845,13 +302775,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 /* SyntaxKind.Parameter */ || - node.kind === 163 /* SyntaxKind.TypeParameter */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 214 /* SyntaxKind.ArrowFunction */ || - node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */) ? + var commentRanges = (node.kind === 166 /* SyntaxKind.Parameter */ || + node.kind === 165 /* SyntaxKind.TypeParameter */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 216 /* SyntaxKind.ArrowFunction */ || + node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); // True if the comment starts with '/**' but not if it is '/**/' @@ -302867,48 +302797,48 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return true; case 114 /* SyntaxKind.VoidKeyword */: - return node.parent.kind !== 217 /* SyntaxKind.VoidExpression */; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + return node.parent.kind !== 219 /* SyntaxKind.VoidExpression */; + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163 /* SyntaxKind.TypeParameter */: - return node.parent.kind === 195 /* SyntaxKind.MappedType */ || node.parent.kind === 190 /* SyntaxKind.InferType */; + case 165 /* SyntaxKind.TypeParameter */: + return node.parent.kind === 197 /* SyntaxKind.MappedType */ || node.parent.kind === 192 /* SyntaxKind.InferType */; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 79 /* SyntaxKind.Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 108 /* SyntaxKind.ThisKeyword */: { var parent = node.parent; - if (parent.kind === 181 /* SyntaxKind.TypeQuery */) { + if (parent.kind === 183 /* SyntaxKind.TypeQuery */) { return false; } - if (parent.kind === 200 /* SyntaxKind.ImportType */) { + if (parent.kind === 202 /* SyntaxKind.ImportType */) { return !parent.isTypeOf; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -302917,40 +302847,40 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (177 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (parent.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return node === parent.constraint; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return node === parent.constraint; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return node === parent.type; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return node === parent.type; - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return node === parent.type; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return node === parent.type; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.contains(parent.typeArguments, node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -302975,23 +302905,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitor(node); - case 263 /* SyntaxKind.CaseBlock */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 266 /* SyntaxKind.CaseBlock */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return ts.forEachChild(node, traverse); } } @@ -303001,23 +302931,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, skip them to avoid the work. return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(node.name.expression); @@ -303040,10 +302970,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 183 /* SyntaxKind.ArrayType */) { + if (node && node.kind === 185 /* SyntaxKind.ArrayType */) { return node.elementType; } - else if (node && node.kind === 178 /* SyntaxKind.TypeReference */) { + else if (node && node.kind === 180 /* SyntaxKind.TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -303053,12 +302983,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 182 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 184 /* SyntaxKind.TypeLiteral */: return node.members; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return node.properties; } } @@ -303066,14 +302996,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 299 /* SyntaxKind.EnumMember */: - case 164 /* SyntaxKind.Parameter */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 302 /* SyntaxKind.EnumMember */: + case 166 /* SyntaxKind.Parameter */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } } @@ -303085,8 +303015,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ - && node.parent.parent.kind === 237 /* SyntaxKind.VariableStatement */; + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ + && node.parent.parent.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -303110,13 +303040,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return true; } return false; @@ -303127,7 +303057,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250 /* SyntaxKind.LabeledStatement */) { + if (node.statement.kind !== 253 /* SyntaxKind.LabeledStatement */) { return node.statement; } node = node.statement; @@ -303135,17 +303065,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) && - (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || - node.parent.kind === 226 /* SyntaxKind.ClassExpression */); + return (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) && + (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || + node.parent.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -303158,7 +303088,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -303220,14 +303150,14 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(node.kind !== 308 /* SyntaxKind.SourceFile */); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that. } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -303242,9 +303172,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -303255,27 +303185,27 @@ var ts; node = node.parent; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 305 /* SyntaxKind.SourceFile */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 308 /* SyntaxKind.SourceFile */: return node; } } @@ -303288,17 +303218,17 @@ var ts; switch (node.kind) { // Arrow functions use the same scope, but may do so in a "delayed" manner // For example, `const getThis = () => this` may be before a super() call in a derived constructor - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Object properties can have computed names; only method-like bodies start a new scope return true; default: @@ -303322,9 +303252,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return container; } } @@ -303346,28 +303276,28 @@ var ts; return node; } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: node = node.parent; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (!stopOnFunctions) { continue; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return node; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -303383,14 +303313,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 /* SyntaxKind.FunctionExpression */ || func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 215 /* SyntaxKind.FunctionExpression */ || func.kind === 216 /* SyntaxKind.ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === prev) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === prev) { return parent; } } @@ -303406,7 +303336,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -303415,7 +303345,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 108 /* SyntaxKind.ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -303434,15 +303364,15 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return node; } return undefined; @@ -303450,10 +303380,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return node.tag; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -303466,25 +303396,25 @@ var ts; return false; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // classes are valid targets return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + return parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 164 /* SyntaxKind.Parameter */: + && parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 166 /* SyntaxKind.Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return parent.body !== undefined - && (parent.kind === 171 /* SyntaxKind.Constructor */ - || parent.kind === 169 /* SyntaxKind.MethodDeclaration */ - || parent.kind === 173 /* SyntaxKind.SetAccessor */) - && grandparent.kind === 257 /* SyntaxKind.ClassDeclaration */; + && (parent.kind === 173 /* SyntaxKind.Constructor */ + || parent.kind === 171 /* SyntaxKind.MethodDeclaration */ + || parent.kind === 175 /* SyntaxKind.SetAccessor */) + && grandparent.kind === 260 /* SyntaxKind.ClassDeclaration */; } return false; } @@ -303500,11 +303430,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217 - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217 default: return false; @@ -303520,9 +303450,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 /* SyntaxKind.JsxOpeningElement */ || - parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || - parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (parent.kind === 283 /* SyntaxKind.JsxOpeningElement */ || + parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || + parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return parent.tagName === node; } return false; @@ -303535,53 +303465,54 @@ var ts; case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 221 /* SyntaxKind.BinaryExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 223 /* SyntaxKind.TemplateExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 224 /* SyntaxKind.YieldExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 225 /* SyntaxKind.TemplateExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 226 /* SyntaxKind.YieldExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 233 /* SyntaxKind.MetaProperty */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return !ts.isHeritageClause(node.parent); - case 161 /* SyntaxKind.QualifiedName */: - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + case 163 /* SyntaxKind.QualifiedName */: + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311 /* SyntaxKind.JSDocMemberName */: + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314 /* SyntaxKind.JSDocMemberName */: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80 /* SyntaxKind.PrivateIdentifier */: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; case 79 /* SyntaxKind.Identifier */: - if (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } // falls through @@ -303599,60 +303530,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: return parent.initializer === node; - case 238 /* SyntaxKind.ExpressionStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 251 /* SyntaxKind.ThrowStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 254 /* SyntaxKind.ThrowStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forInStatement.expression === node; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return node === parent.expression; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node === parent.expression; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return node === parent.expression; - case 165 /* SyntaxKind.Decorator */: - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 167 /* SyntaxKind.Decorator */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 301 /* SyntaxKind.SpreadAssignment */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return parent.expression === node && !isPartOfTypeNode(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return parent.objectAssignmentInitializer === node; + case 235 /* SyntaxKind.SatisfiesExpression */: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { + while (node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { node = node.parent; } - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -303660,7 +303593,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -303673,7 +303606,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -303705,11 +303638,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */); + (node.typeArguments[0].kind === 152 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (callExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -303818,11 +303751,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 /* SyntaxKind.FunctionExpression */ || e.kind === 214 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; + return e.kind === 215 /* SyntaxKind.FunctionExpression */ || e.kind === 216 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 213 /* SyntaxKind.FunctionExpression */ || - initializer.kind === 226 /* SyntaxKind.ClassExpression */ || - initializer.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (initializer.kind === 215 /* SyntaxKind.FunctionExpression */ || + initializer.kind === 228 /* SyntaxKind.ClassExpression */ || + initializer.kind === 216 /* SyntaxKind.ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -304068,7 +304001,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + expr.parent && expr.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -304089,17 +304022,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -304112,14 +304045,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.parent; - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return node.parent.parent; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined; - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -304129,16 +304062,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; - case 200 /* SyntaxKind.ImportType */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + return node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 202 /* SyntaxKind.ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return node.arguments[0]; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node.name.kind === 10 /* SyntaxKind.StringLiteral */ ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -304147,11 +304080,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -304159,7 +304092,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -304180,13 +304113,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return node.questionToken !== undefined; } } @@ -304200,7 +304133,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 338 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 341 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -304225,12 +304158,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return node.initializer; } } @@ -304242,7 +304175,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 /* SyntaxKind.ModuleDeclaration */ + node.body.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? node.body : undefined; } @@ -304257,11 +304190,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -304290,11 +304223,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - parent.kind === 271 /* SyntaxKind.ExportAssignment */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 247 /* SyntaxKind.ReturnStatement */ || + if (parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + parent.kind === 274 /* SyntaxKind.ExportAssignment */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 250 /* SyntaxKind.ReturnStatement */ || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return parent; @@ -304404,34 +304337,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 /* SyntaxKind.EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* AssignmentKind.Definite */ : 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 45 /* SyntaxKind.PlusPlusToken */ || unaryOperator === 46 /* SyntaxKind.MinusMinusToken */ ? 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return parent.initializer === node ? 1 /* AssignmentKind.Definite */ : 0 /* AssignmentKind.None */; - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 232 /* SyntaxKind.NonNullExpression */: node = parent; break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: node = parent.parent; break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* AssignmentKind.None */; } node = parent.parent; break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (parent.name === node) { return 0 /* AssignmentKind.None */; } @@ -304458,22 +304391,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 237 /* SyntaxKind.VariableStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 238 /* SyntaxKind.Block */: + case 240 /* SyntaxKind.VariableStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return true; } return false; @@ -304490,11 +304423,11 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191 /* SyntaxKind.ParenthesizedType */); + return walkUp(node, 193 /* SyntaxKind.ParenthesizedType */); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212 /* SyntaxKind.ParenthesizedExpression */); + return walkUp(node, 214 /* SyntaxKind.ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; /** @@ -304504,7 +304437,7 @@ var ts; */ function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191 /* SyntaxKind.ParenthesizedType */) { + while (node && node.kind === 193 /* SyntaxKind.ParenthesizedType */) { child = node; node = node.parent; } @@ -304526,11 +304459,11 @@ var ts; ts.skipParentheses = skipParentheses; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 207 /* SyntaxKind.ElementAccessExpression */) { + if (node.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 209 /* SyntaxKind.ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node && node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -304583,7 +304516,7 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */ && + node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */ && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -304591,29 +304524,29 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: // Name on right hand side of dot in a type query or type reference return parent.right === node; - case 203 /* SyntaxKind.BindingElement */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 275 /* SyntaxKind.ExportSpecifier */: - case 285 /* SyntaxKind.JsxAttribute */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 288 /* SyntaxKind.JsxAttribute */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: // Any name in an export specifier or JSX Attribute or Jsx Element return true; } @@ -304636,14 +304569,14 @@ var ts; // const x = require("...").y // const { x } = require("...").y function isAliasSymbolDeclaration(node) { - if (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name || - node.kind === 268 /* SyntaxKind.NamespaceImport */ || - node.kind === 274 /* SyntaxKind.NamespaceExport */ || - node.kind === 270 /* SyntaxKind.ImportSpecifier */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name || + node.kind === 271 /* SyntaxKind.NamespaceImport */ || + node.kind === 277 /* SyntaxKind.NamespaceExport */ || + node.kind === 273 /* SyntaxKind.ImportSpecifier */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && exportAssignmentIsAlias(node) || @@ -304656,18 +304589,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 271 /* SyntaxKind.ExportAssignment */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 274 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */); + } while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -304686,7 +304619,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.initializer : + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -304752,11 +304685,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 160 /* SyntaxKind.LastKeyword */; + return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 162 /* SyntaxKind.LastKeyword */; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 160 /* SyntaxKind.LastContextualKeyword */; + return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 162 /* SyntaxKind.LastContextualKeyword */; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -304800,15 +304733,15 @@ var ts; } var flags = 0 /* FunctionFlags.Normal */; switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* FunctionFlags.Generator */; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: - if (hasSyntacticModifier(node, 256 /* ModifierFlags.Async */)) { + case 216 /* SyntaxKind.ArrowFunction */: + if (hasSyntacticModifier(node, 512 /* ModifierFlags.Async */)) { flags |= 2 /* FunctionFlags.Async */; } break; @@ -304821,13 +304754,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256 /* ModifierFlags.Async */); + && hasSyntacticModifier(node, 512 /* ModifierFlags.Async */); } return false; } @@ -304854,7 +304787,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 /* SyntaxKind.ComputedPropertyName */ || name.kind === 207 /* SyntaxKind.ElementAccessExpression */)) { + if (!(name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || name.kind === 209 /* SyntaxKind.ElementAccessExpression */)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -304870,7 +304803,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -304936,11 +304869,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164 /* SyntaxKind.Parameter */; + return root.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203 /* SyntaxKind.BindingElement */) { + while (node.kind === 205 /* SyntaxKind.BindingElement */) { node = node.parent.parent; } return node; @@ -304948,15 +304881,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 305 /* SyntaxKind.SourceFile */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 308 /* SyntaxKind.SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -304975,23 +304908,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 0 /* Associativity.Left */ : 1 /* Associativity.Right */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 1 /* Associativity.Right */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operator) { case 42 /* SyntaxKind.AsteriskAsteriskToken */: case 63 /* SyntaxKind.EqualsToken */: @@ -305018,15 +304951,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expression.kind === 223 /* SyntaxKind.BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 220 /* SyntaxKind.PostfixUnaryExpression */) { + else if (expression.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 222 /* SyntaxKind.PostfixUnaryExpression */) { return expression.operator; } else { @@ -305205,15 +305138,15 @@ var ts; })(OperatorPrecedence = ts.OperatorPrecedence || (ts.OperatorPrecedence = {})); function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return 0 /* OperatorPrecedence.Comma */; - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return 1 /* OperatorPrecedence.Spread */; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 2 /* OperatorPrecedence.Yield */; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return 4 /* OperatorPrecedence.Conditional */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operatorKind) { case 27 /* SyntaxKind.CommaToken */: return 0 /* OperatorPrecedence.Comma */; @@ -305238,26 +305171,27 @@ var ts; return getBinaryOperatorPrecedence(operatorKind); } // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return 16 /* OperatorPrecedence.Unary */; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return 17 /* OperatorPrecedence.Update */; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return 18 /* OperatorPrecedence.LeftHandSide */; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 19 /* OperatorPrecedence.Member */ : 18 /* OperatorPrecedence.LeftHandSide */; - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 233 /* SyntaxKind.MetaProperty */: return 19 /* OperatorPrecedence.Member */; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return 11 /* OperatorPrecedence.Relational */; case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: @@ -305269,19 +305203,19 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 225 /* SyntaxKind.TemplateExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: return 20 /* OperatorPrecedence.Primary */; default: return -1 /* OperatorPrecedence.Invalid */; @@ -305313,7 +305247,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: return 11 /* OperatorPrecedence.Relational */; case 47 /* SyntaxKind.LessThanLessThanToken */: case 48 /* SyntaxKind.GreaterThanGreaterThanToken */: @@ -305337,7 +305272,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !!i.expression; case 11 /* SyntaxKind.JsxText */: return !i.containsOnlyTriviaWhiteSpaces; @@ -305393,7 +305328,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -305929,7 +305864,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */; + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -305944,10 +305879,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { + if (accessor.kind === 174 /* SyntaxKind.GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { setAccessor = accessor; } else { @@ -305967,10 +305902,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 /* SyntaxKind.GetAccessor */ && !getAccessor) { + if (member.kind === 174 /* SyntaxKind.GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && !setAccessor) { + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -306019,7 +305954,7 @@ var ts; ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; /** template tags are only available when a typedef isn't already using them */ function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); } /** * Gets the effective type annotation of the value parameter of a set accessor. If the node @@ -306252,13 +306187,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + return hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128 /* ModifierFlags.Accessor */); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64 /* ModifierFlags.Readonly */); } @@ -306276,7 +306215,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 162 /* SyntaxKind.LastToken */) { return 0 /* ModifierFlags.None */; } if (!(node.modifierFlagsCache & 536870912 /* ModifierFlags.HasComputedFlags */)) { @@ -306368,25 +306307,22 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: return 4 /* ModifierFlags.Public */; case 122 /* SyntaxKind.ProtectedKeyword */: return 16 /* ModifierFlags.Protected */; case 121 /* SyntaxKind.PrivateKeyword */: return 8 /* ModifierFlags.Private */; - case 126 /* SyntaxKind.AbstractKeyword */: return 128 /* ModifierFlags.Abstract */; + case 126 /* SyntaxKind.AbstractKeyword */: return 256 /* ModifierFlags.Abstract */; + case 127 /* SyntaxKind.AccessorKeyword */: return 128 /* ModifierFlags.Accessor */; case 93 /* SyntaxKind.ExportKeyword */: return 1 /* ModifierFlags.Export */; - case 135 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; + case 136 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; case 85 /* SyntaxKind.ConstKeyword */: return 2048 /* ModifierFlags.Const */; - case 88 /* SyntaxKind.DefaultKeyword */: return 512 /* ModifierFlags.Default */; - case 131 /* SyntaxKind.AsyncKeyword */: return 256 /* ModifierFlags.Async */; - case 145 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; - case 159 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; + case 88 /* SyntaxKind.DefaultKeyword */: return 1024 /* ModifierFlags.Default */; + case 132 /* SyntaxKind.AsyncKeyword */: return 512 /* ModifierFlags.Async */; + case 146 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; + case 161 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; case 101 /* SyntaxKind.InKeyword */: return 32768 /* ModifierFlags.In */; - case 144 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; - case 165 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; + case 145 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; + case 167 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; } return 0 /* ModifierFlags.None */; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 /* SyntaxKind.BarBarToken */ || token === 55 /* SyntaxKind.AmpersandAmpersandToken */ @@ -306436,8 +306372,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 205 /* SyntaxKind.ObjectLiteralExpression */ - || kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return kind === 207 /* SyntaxKind.ObjectLiteralExpression */ + || kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } return false; } @@ -306454,12 +306390,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 79 /* SyntaxKind.Identifier */); @@ -306471,9 +306407,9 @@ var ts; return node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 108 /* SyntaxKind.ThisKeyword */ || node.kind === 106 /* SyntaxKind.SuperKeyword */ - || node.kind === 231 /* SyntaxKind.MetaProperty */ - || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) - || node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); + || node.kind === 233 /* SyntaxKind.MetaProperty */ + || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) + || node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -306504,8 +306440,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -306520,12 +306456,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + return expression.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && + return expression.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -306541,7 +306477,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512 /* ModifierFlags.Default */); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024 /* ModifierFlags.Default */); } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTSExtension(fileName) { @@ -306686,21 +306622,17 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + // gracefully handle if readFile fails or returns not JSON + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -306859,8 +306791,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -306876,7 +306808,7 @@ var ts; } function isWatchSet(options) { // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -306940,35 +306872,35 @@ var ts; if (!parent) return 0 /* AccessKind.Read */; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return accessKind(parent); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var operator = parent.operator; return operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */ ? writeOrReadWrite() : 0 /* AccessKind.Read */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ ? 1 /* AccessKind.Write */ : writeOrReadWrite() : 0 /* AccessKind.Read */; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node ? 0 /* AccessKind.Read */ : accessKind(parent); - case 296 /* SyntaxKind.PropertyAssignment */: { + case 299 /* SyntaxKind.PropertyAssignment */: { var parentAccess = accessKind(parent.parent); // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. return node === parent.objectAssignmentInitializer ? 0 /* AccessKind.Read */ : accessKind(parent.parent); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return accessKind(parent); default: return 0 /* AccessKind.Read */; } function writeOrReadWrite() { // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; } } function reverseAccessKind(a) { @@ -307050,7 +306982,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32 /* SymbolFlags.Class */) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + return !!declaration && hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); } return false; } @@ -307112,37 +307044,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) - || kind === 130 /* SyntaxKind.AnyKeyword */ - || kind === 155 /* SyntaxKind.UnknownKeyword */ - || kind === 147 /* SyntaxKind.NumberKeyword */ - || kind === 158 /* SyntaxKind.BigIntKeyword */ - || kind === 148 /* SyntaxKind.ObjectKeyword */ - || kind === 133 /* SyntaxKind.BooleanKeyword */ - || kind === 150 /* SyntaxKind.StringKeyword */ - || kind === 151 /* SyntaxKind.SymbolKeyword */ + return (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) + || kind === 131 /* SyntaxKind.AnyKeyword */ + || kind === 157 /* SyntaxKind.UnknownKeyword */ + || kind === 148 /* SyntaxKind.NumberKeyword */ + || kind === 160 /* SyntaxKind.BigIntKeyword */ + || kind === 149 /* SyntaxKind.ObjectKeyword */ + || kind === 134 /* SyntaxKind.BooleanKeyword */ + || kind === 152 /* SyntaxKind.StringKeyword */ + || kind === 153 /* SyntaxKind.SymbolKeyword */ || kind === 114 /* SyntaxKind.VoidKeyword */ - || kind === 153 /* SyntaxKind.UndefinedKeyword */ - || kind === 143 /* SyntaxKind.NeverKeyword */ - || kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ - || kind === 312 /* SyntaxKind.JSDocAllType */ - || kind === 313 /* SyntaxKind.JSDocUnknownType */ - || kind === 314 /* SyntaxKind.JSDocNullableType */ - || kind === 315 /* SyntaxKind.JSDocNonNullableType */ - || kind === 316 /* SyntaxKind.JSDocOptionalType */ - || kind === 317 /* SyntaxKind.JSDocFunctionType */ - || kind === 318 /* SyntaxKind.JSDocVariadicType */; + || kind === 155 /* SyntaxKind.UndefinedKeyword */ + || kind === 144 /* SyntaxKind.NeverKeyword */ + || kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ + || kind === 315 /* SyntaxKind.JSDocAllType */ + || kind === 316 /* SyntaxKind.JSDocUnknownType */ + || kind === 317 /* SyntaxKind.JSDocNullableType */ + || kind === 318 /* SyntaxKind.JSDocNonNullableType */ + || kind === 319 /* SyntaxKind.JSDocOptionalType */ + || kind === 320 /* SyntaxKind.JSDocFunctionType */ + || kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { return node.name; } - ts.Debug.assert(node.kind === 207 /* SyntaxKind.ElementAccessExpression */); + ts.Debug.assert(node.kind === 209 /* SyntaxKind.ElementAccessExpression */); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -307157,7 +307089,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 272 /* SyntaxKind.NamedImports */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -307172,13 +307104,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (access.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + else if (access.kind === 209 /* SyntaxKind.ElementAccessExpression */) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -307205,28 +307137,29 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: node = node.operand; continue; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: node = node.left; continue; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: node = node.condition; continue; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: node = node.tag; continue; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 229 /* SyntaxKind.AsExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: node = node.expression; continue; } @@ -308462,17 +308395,17 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } - if (hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */)) { + if (hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 182 /* SyntaxKind.TypeLiteral */; + return containerKind === 261 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 184 /* SyntaxKind.TypeLiteral */; } /** Returns true for an identifier in 1) an `implements` clause, and 2) an `extends` clause of an interface. */ function isIdentifierInNonEmittingHeritageClause(node) { @@ -308480,16 +308413,16 @@ var ts; return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258 /* SyntaxKind.InterfaceDeclaration */; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261 /* SyntaxKind.InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -308650,22 +308583,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: var parent_1 = node.parent; - return parent_1.kind === 190 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; - case 164 /* SyntaxKind.Parameter */: + return parent_1.kind === 192 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; + case 166 /* SyntaxKind.Parameter */: return node.parent.parameters; - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node.parent.templateSpans; - case 165 /* SyntaxKind.Decorator */: { + case 167 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return node.parent.heritageClauses; } var parent = node.parent; @@ -308673,45 +308606,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182 /* SyntaxKind.TypeLiteral */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.isTypeElement(node) ? parent.members : undefined; - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return parent.types; - case 184 /* SyntaxKind.TupleType */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 186 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return parent.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 286 /* SyntaxKind.JsxAttributes */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 289 /* SyntaxKind.JsxAttributes */: return parent.properties; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278 /* SyntaxKind.JsxElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 285 /* SyntaxKind.JsxFragment */: return ts.isJsxChild(node) ? parent.children : undefined; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: return parent.statements; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return parent.clauses; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.isClassElement(node) ? parent.members : undefined; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.isEnumMember(node) ? parent.members : undefined; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return parent.statements; } } @@ -308723,7 +308656,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { // If the first parameter is not an explicit 'this' parameter, then the function has // an implicit 'this' parameter which is subject to contextual typing. var parameter = ts.firstOrUndefined(node.parameters); @@ -308741,7 +308674,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -308750,7 +308683,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */ || node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */ || node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -308847,9 +308780,35 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; + function isTypeDeclaration(node) { + switch (node.kind) { + case 165 /* SyntaxKind.TypeParameter */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + return true; + case 270 /* SyntaxKind.ImportClause */: + return node.isTypeOnly; + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + return node.parent.parent.isTypeOnly; + default: + return false; + } + } + ts.isTypeDeclaration = isTypeDeclaration; + function canHaveExportModifier(node) { + return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) + || ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node)); + } + ts.canHaveExportModifier = canHaveExportModifier; })(ts || (ts = {})); /* @internal */ var ts; @@ -308858,13 +308817,11 @@ var ts; * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator. */ function createBaseNodeFactory() { - // tslint:disable variable-name var NodeConstructor; var TokenConstructor; var IdentifierConstructor; var PrivateIdentifierConstructor; var SourceFileConstructor; - // tslint:enable variable-name return { createBaseSourceFileNode: createBaseSourceFileNode, createBaseIdentifierNode: createBaseIdentifierNode, @@ -308972,10 +308929,10 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223 /* SyntaxKind.BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 216 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` return true; @@ -308987,7 +308944,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Associativity.Right */ - && operand.kind === 224 /* SyntaxKind.YieldExpression */) { + && operand.kind === 226 /* SyntaxKind.YieldExpression */) { return false; } return true; @@ -309056,13 +309013,15 @@ var ts; // (a|b)|c -> a|(b|c) -> a|b|c // (a&b)&c -> a&(b&c) -> a&b&c // (a^b)^c -> a^(b^c) -> a^b^c + // (a,b),c -> a,(b,c) -> a,b,c // // While addition is associative in mathematics, JavaScript's `+` is not // guaranteed to be associative as it is overloaded with string concatenation. return binaryOperator === 41 /* SyntaxKind.AsteriskToken */ || binaryOperator === 51 /* SyntaxKind.BarToken */ || binaryOperator === 50 /* SyntaxKind.AmpersandToken */ - || binaryOperator === 52 /* SyntaxKind.CaretToken */; + || binaryOperator === 52 /* SyntaxKind.CaretToken */ + || binaryOperator === 27 /* SyntaxKind.CommaToken */; } /** * This function determines whether an expression consists of a homogeneous set of @@ -309075,7 +309034,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -309101,7 +309060,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (skipped.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -309118,7 +309077,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(224 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* Comparison.GreaterThan */) { @@ -309151,8 +309110,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: needsParens = true; } } @@ -309165,9 +309124,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return factory.createParenthesizedExpression(expression); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; // TODO(rbuckton): Verify this assertion holds @@ -309187,7 +309146,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 211 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { // TODO(rbuckton): Verify whether this assertion holds. return expression; @@ -309210,7 +309169,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -309219,21 +309178,21 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 /* SyntaxKind.FunctionExpression */ || kind === 214 /* SyntaxKind.ArrowFunction */) { + if (kind === 215 /* SyntaxKind.FunctionExpression */ || kind === 216 /* SyntaxKind.ArrowFunction */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 205 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 213 /* SyntaxKind.FunctionExpression */) { + if (leftmostExpressionKind === 207 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 215 /* SyntaxKind.FunctionExpression */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(body), body); } @@ -309251,16 +309210,16 @@ var ts; // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 189 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(extendsType); } return extendsType; @@ -309272,8 +309231,8 @@ var ts; // - A union type constituent has the same precedence as the check type of a conditional type function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 189 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -309288,8 +309247,8 @@ var ts; // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized) function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -309306,14 +309265,14 @@ var ts; // function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -309333,9 +309292,9 @@ var ts; // function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190 /* SyntaxKind.InferType */: - case 193 /* SyntaxKind.TypeOperator */: - case 181 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 192 /* SyntaxKind.InferType */: + case 195 /* SyntaxKind.TypeOperator */: + case 183 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -309529,11 +309488,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -309627,6 +309586,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -309789,6 +309750,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -309886,18 +309849,18 @@ var ts; createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* SyntaxKind.JSDocAllType */); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* SyntaxKind.JSDocUnknownType */); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315 /* SyntaxKind.JSDocAllType */); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316 /* SyntaxKind.JSDocUnknownType */); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -309933,30 +309896,30 @@ var ts; createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -310159,11 +310122,11 @@ var ts; // don't propagate child flags. if (name) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -310312,23 +310275,29 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } // @api - function createIdentifier(text, typeArguments, originalKeywordKind) { + function createIdentifier(text, typeArguments, originalKeywordKind, hasExtendedUnicodeEscape) { var node = createBaseIdentifier(text, originalKeywordKind); if (typeArguments) { // NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; } + if (hasExtendedUnicodeEscape) { + node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; + } return node; } // @api @@ -310338,11 +310307,11 @@ var ts; : node; } // @api - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1 /* GeneratedIdentifierFlags.Auto */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -310354,34 +310323,69 @@ var ts; var flags = 2 /* GeneratedIdentifierFlags.Loop */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined); } /** Create a unique name based on the supplied text. */ // @api - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0 /* GeneratedIdentifierFlags.None */; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */)) !== 32 /* GeneratedIdentifierFlags.FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags); + return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags, prefix, suffix); } /** Create a unique name generated for a node. */ // @api - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* GeneratedIdentifierFlags.Node */ | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16 /* GeneratedIdentifierFlags.Optimistic */; + var name = createBaseGeneratedIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); name.original = node; return name; } + function createBasePrivateIdentifier(text) { + var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); + node.escapedText = ts.escapeLeadingUnderscores(text); + node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return node; + } // @api function createPrivateIdentifier(text) { if (!ts.startsWith(text, "#")) ts.Debug.fail("First character of private identifier must be #: " + text); - var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); - node.escapedText = ts.escapeLeadingUnderscores(text); - node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; return node; } + /** Create a unique name based on the supplied text. */ + // @api + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */ | + (text ? 3 /* GeneratedIdentifierFlags.Unique */ : 1 /* GeneratedIdentifierFlags.Auto */); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + // @api + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 /* GeneratedIdentifierFlags.Optimistic */ : 0 /* GeneratedIdentifierFlags.None */; + var name = createBaseGeneratedPrivateIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); + name.original = node; + return name; + } // // Punctuation // @@ -310389,14 +310393,14 @@ var ts; return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 160 /* SyntaxKind.LastToken */, "Invalid token"); + ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 162 /* SyntaxKind.LastToken */, "Invalid token"); ts.Debug.assert(token <= 14 /* SyntaxKind.FirstTemplateToken */ || token >= 17 /* SyntaxKind.LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 /* SyntaxKind.FirstLiteralToken */ || token >= 14 /* SyntaxKind.LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79 /* SyntaxKind.Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0 /* TransformFlags.None */; switch (token) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = 256 /* TransformFlags.ContainsES2017 */ | @@ -310405,24 +310409,24 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. + case 157 /* SyntaxKind.UnknownKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* TransformFlags.ContainsTypeScript */; break; case 106 /* SyntaxKind.SuperKeyword */: @@ -310431,6 +310435,9 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: transformFlags = 1024 /* TransformFlags.ContainsES2015 */; break; + case 127 /* SyntaxKind.AccessorKeyword */: + transformFlags = 16777216 /* TransformFlags.ContainsClassFields */; + break; case 108 /* SyntaxKind.ThisKeyword */: // 'this' indicates a lexical 'this' transformFlags = 16384 /* TransformFlags.ContainsLexicalThis */; @@ -310477,8 +310484,8 @@ var ts; if (flags & 1 /* ModifierFlags.Export */) result.push(createModifier(93 /* SyntaxKind.ExportKeyword */)); if (flags & 2 /* ModifierFlags.Ambient */) - result.push(createModifier(135 /* SyntaxKind.DeclareKeyword */)); - if (flags & 512 /* ModifierFlags.Default */) + result.push(createModifier(136 /* SyntaxKind.DeclareKeyword */)); + if (flags & 1024 /* ModifierFlags.Default */) result.push(createModifier(88 /* SyntaxKind.DefaultKeyword */)); if (flags & 2048 /* ModifierFlags.Const */) result.push(createModifier(85 /* SyntaxKind.ConstKeyword */)); @@ -310488,20 +310495,22 @@ var ts; result.push(createModifier(121 /* SyntaxKind.PrivateKeyword */)); if (flags & 16 /* ModifierFlags.Protected */) result.push(createModifier(122 /* SyntaxKind.ProtectedKeyword */)); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push(createModifier(126 /* SyntaxKind.AbstractKeyword */)); if (flags & 32 /* ModifierFlags.Static */) result.push(createModifier(124 /* SyntaxKind.StaticKeyword */)); if (flags & 16384 /* ModifierFlags.Override */) - result.push(createModifier(159 /* SyntaxKind.OverrideKeyword */)); + result.push(createModifier(161 /* SyntaxKind.OverrideKeyword */)); if (flags & 64 /* ModifierFlags.Readonly */) - result.push(createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); - if (flags & 256 /* ModifierFlags.Async */) - result.push(createModifier(131 /* SyntaxKind.AsyncKeyword */)); + result.push(createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); + if (flags & 128 /* ModifierFlags.Accessor */) + result.push(createModifier(127 /* SyntaxKind.AccessorKeyword */)); + if (flags & 512 /* ModifierFlags.Async */) + result.push(createModifier(132 /* SyntaxKind.AsyncKeyword */)); if (flags & 32768 /* ModifierFlags.In */) result.push(createModifier(101 /* SyntaxKind.InKeyword */)); if (flags & 65536 /* ModifierFlags.Out */) - result.push(createModifier(144 /* SyntaxKind.OutKeyword */)); + result.push(createModifier(145 /* SyntaxKind.OutKeyword */)); return result.length ? result : undefined; } // @@ -310509,7 +310518,7 @@ var ts; // // @api function createQualifiedName(left, right) { - var node = createBaseNode(161 /* SyntaxKind.QualifiedName */); + var node = createBaseNode(163 /* SyntaxKind.QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= @@ -310526,7 +310535,7 @@ var ts; } // @api function createComputedPropertyName(expression) { - var node = createBaseNode(162 /* SyntaxKind.ComputedPropertyName */); + var node = createBaseNode(164 /* SyntaxKind.ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -310545,7 +310554,7 @@ var ts; // // @api function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163 /* SyntaxKind.TypeParameter */, modifiers, name); + var node = createBaseNamedDeclaration(165 /* SyntaxKind.TypeParameter */, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -310562,7 +310571,7 @@ var ts; } // @api function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -310594,7 +310603,7 @@ var ts; } // @api function createDecorator(expression) { - var node = createBaseNode(165 /* SyntaxKind.Decorator */); + var node = createBaseNode(167 /* SyntaxKind.Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -310614,7 +310623,7 @@ var ts; // // @api function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166 /* SyntaxKind.PropertySignature */, modifiers, name); + var node = createBaseNamedDeclaration(168 /* SyntaxKind.PropertySignature */, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -310640,7 +310649,7 @@ var ts; } // @api function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -310668,7 +310677,7 @@ var ts; } // @api function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -310686,7 +310695,7 @@ var ts; } // @api function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -310696,7 +310705,7 @@ var ts; if (questionToken) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -310732,7 +310741,7 @@ var ts; } // @api function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170 /* SyntaxKind.ClassStaticBlockDeclaration */, + var node = createBaseGenericNamedDeclaration(172 /* SyntaxKind.ClassStaticBlockDeclaration */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined); @@ -310758,7 +310767,7 @@ var ts; } // @api function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.Constructor */, modifiers, + var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.Constructor */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); @@ -310787,7 +310796,7 @@ var ts; } // @api function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172 /* SyntaxKind.GetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(174 /* SyntaxKind.GetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, type, body); // The following properties are used only to report grammar errors node.typeParameters = undefined; @@ -310811,7 +310820,7 @@ var ts; } // @api function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.SetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(175 /* SyntaxKind.SetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); // The following properties are used only to report grammar errors @@ -310837,7 +310846,7 @@ var ts; } // @api function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174 /* SyntaxKind.CallSignature */, + var node = createBaseSignatureDeclaration(176 /* SyntaxKind.CallSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -310853,7 +310862,7 @@ var ts; } // @api function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175 /* SyntaxKind.ConstructSignature */, + var node = createBaseSignatureDeclaration(177 /* SyntaxKind.ConstructSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -310869,7 +310878,7 @@ var ts; } // @api function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176 /* SyntaxKind.IndexSignature */, modifiers, + var node = createBaseSignatureDeclaration(178 /* SyntaxKind.IndexSignature */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -310885,7 +310894,7 @@ var ts; } // @api function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199 /* SyntaxKind.TemplateLiteralTypeSpan */); + var node = createBaseNode(201 /* SyntaxKind.TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -310907,7 +310916,7 @@ var ts; } // @api function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177 /* SyntaxKind.TypePredicate */); + var node = createBaseNode(179 /* SyntaxKind.TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -310924,7 +310933,7 @@ var ts; } // @api function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178 /* SyntaxKind.TypeReference */); + var node = createBaseNode(180 /* SyntaxKind.TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -310939,7 +310948,7 @@ var ts; } // @api function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179 /* SyntaxKind.FunctionType */, + var node = createBaseSignatureDeclaration(181 /* SyntaxKind.FunctionType */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -310972,7 +310981,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180 /* SyntaxKind.ConstructorType */, modifiers, + var node = createBaseSignatureDeclaration(182 /* SyntaxKind.ConstructorType */, modifiers, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -311005,7 +311014,7 @@ var ts; } // @api function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181 /* SyntaxKind.TypeQuery */); + var node = createBaseNode(183 /* SyntaxKind.TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -311020,7 +311029,7 @@ var ts; } // @api function createTypeLiteralNode(members) { - var node = createBaseNode(182 /* SyntaxKind.TypeLiteral */); + var node = createBaseNode(184 /* SyntaxKind.TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -311033,7 +311042,7 @@ var ts; } // @api function createArrayTypeNode(elementType) { - var node = createBaseNode(183 /* SyntaxKind.ArrayType */); + var node = createBaseNode(185 /* SyntaxKind.ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -311046,7 +311055,7 @@ var ts; } // @api function createTupleTypeNode(elements) { - var node = createBaseNode(184 /* SyntaxKind.TupleType */); + var node = createBaseNode(186 /* SyntaxKind.TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -311059,7 +311068,7 @@ var ts; } // @api function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197 /* SyntaxKind.NamedTupleMember */); + var node = createBaseNode(199 /* SyntaxKind.NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -311078,7 +311087,7 @@ var ts; } // @api function createOptionalTypeNode(type) { - var node = createBaseNode(185 /* SyntaxKind.OptionalType */); + var node = createBaseNode(187 /* SyntaxKind.OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -311091,7 +311100,7 @@ var ts; } // @api function createRestTypeNode(type) { - var node = createBaseNode(186 /* SyntaxKind.RestType */); + var node = createBaseNode(188 /* SyntaxKind.RestType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -311115,7 +311124,7 @@ var ts; } // @api function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } // @api function updateUnionTypeNode(node, types) { @@ -311123,7 +311132,7 @@ var ts; } // @api function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } // @api function updateIntersectionTypeNode(node, types) { @@ -311131,7 +311140,7 @@ var ts; } // @api function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189 /* SyntaxKind.ConditionalType */); + var node = createBaseNode(191 /* SyntaxKind.ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -311150,7 +311159,7 @@ var ts; } // @api function createInferTypeNode(typeParameter) { - var node = createBaseNode(190 /* SyntaxKind.InferType */); + var node = createBaseNode(192 /* SyntaxKind.InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -311163,7 +311172,7 @@ var ts; } // @api function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198 /* SyntaxKind.TemplateLiteralType */); + var node = createBaseNode(200 /* SyntaxKind.TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -311179,7 +311188,7 @@ var ts; // @api function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200 /* SyntaxKind.ImportType */); + var node = createBaseNode(202 /* SyntaxKind.ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -311201,7 +311210,7 @@ var ts; } // @api function createParenthesizedType(type) { - var node = createBaseNode(191 /* SyntaxKind.ParenthesizedType */); + var node = createBaseNode(193 /* SyntaxKind.ParenthesizedType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -311214,15 +311223,15 @@ var ts; } // @api function createThisTypeNode() { - var node = createBaseNode(192 /* SyntaxKind.ThisType */); + var node = createBaseNode(194 /* SyntaxKind.ThisType */); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; } // @api function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193 /* SyntaxKind.TypeOperator */); + var node = createBaseNode(195 /* SyntaxKind.TypeOperator */); node.operator = operator; - node.type = operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + node.type = operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -311236,7 +311245,7 @@ var ts; } // @api function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194 /* SyntaxKind.IndexedAccessType */); + var node = createBaseNode(196 /* SyntaxKind.IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -311251,7 +311260,7 @@ var ts; } // @api function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195 /* SyntaxKind.MappedType */); + var node = createBaseNode(197 /* SyntaxKind.MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -311274,7 +311283,7 @@ var ts; } // @api function createLiteralTypeNode(literal) { - var node = createBaseNode(196 /* SyntaxKind.LiteralType */); + var node = createBaseNode(198 /* SyntaxKind.LiteralType */); node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -311290,7 +311299,7 @@ var ts; // // @api function createObjectBindingPattern(elements) { - var node = createBaseNode(201 /* SyntaxKind.ObjectBindingPattern */); + var node = createBaseNode(203 /* SyntaxKind.ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -311311,7 +311320,7 @@ var ts; } // @api function createArrayBindingPattern(elements) { - var node = createBaseNode(202 /* SyntaxKind.ArrayBindingPattern */); + var node = createBaseNode(204 /* SyntaxKind.ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -311327,7 +311336,7 @@ var ts; } // @api function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203 /* SyntaxKind.BindingElement */, + var node = createBaseBindingLikeDeclaration(205 /* SyntaxKind.BindingElement */, /*modifiers*/ undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; @@ -311362,7 +311371,7 @@ var ts; } // @api function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204 /* SyntaxKind.ArrayLiteralExpression */); + var node = createBaseExpression(206 /* SyntaxKind.ArrayLiteralExpression */); // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpresion]` so that // we end up with `[1, 2, ,]` instead of `[1, 2, ]` otherwise the `OmittedExpression` will just end up being treated like // a trailing comma. @@ -311381,7 +311390,7 @@ var ts; } // @api function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205 /* SyntaxKind.ObjectLiteralExpression */); + var node = createBaseExpression(207 /* SyntaxKind.ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -311395,7 +311404,7 @@ var ts; } // @api function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.name = asName(name); node.transformFlags = @@ -311424,7 +311433,7 @@ var ts; } // @api function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -311451,7 +311460,7 @@ var ts; } // @api function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -311478,7 +311487,7 @@ var ts; } // @api function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -311503,7 +311512,7 @@ var ts; } // @api function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -311535,7 +311544,7 @@ var ts; } // @api function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -311567,7 +311576,7 @@ var ts; } // @api function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209 /* SyntaxKind.NewExpression */); + var node = createBaseExpression(211 /* SyntaxKind.NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -311591,7 +311600,7 @@ var ts; } // @api function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210 /* SyntaxKind.TaggedTemplateExpression */); + var node = createBaseExpression(212 /* SyntaxKind.TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -311618,7 +311627,7 @@ var ts; } // @api function createTypeAssertion(type, expression) { - var node = createBaseExpression(211 /* SyntaxKind.TypeAssertionExpression */); + var node = createBaseExpression(213 /* SyntaxKind.TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -311636,7 +311645,7 @@ var ts; } // @api function createParenthesizedExpression(expression) { - var node = createBaseExpression(212 /* SyntaxKind.ParenthesizedExpression */); + var node = createBaseExpression(214 /* SyntaxKind.ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -311649,13 +311658,13 @@ var ts; } // @api function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -311682,13 +311691,13 @@ var ts; } // @api function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214 /* SyntaxKind.ArrowFunction */, modifiers, + var node = createBaseFunctionLikeDeclaration(216 /* SyntaxKind.ArrowFunction */, modifiers, /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* SyntaxKind.EqualsGreaterThanToken */); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024 /* TransformFlags.ContainsES2015 */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { node.transformFlags |= 256 /* TransformFlags.ContainsES2017 */ | 16384 /* TransformFlags.ContainsLexicalThis */; } return node; @@ -311706,7 +311715,7 @@ var ts; } // @api function createDeleteExpression(expression) { - var node = createBaseExpression(215 /* SyntaxKind.DeleteExpression */); + var node = createBaseExpression(217 /* SyntaxKind.DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -311719,7 +311728,7 @@ var ts; } // @api function createTypeOfExpression(expression) { - var node = createBaseExpression(216 /* SyntaxKind.TypeOfExpression */); + var node = createBaseExpression(218 /* SyntaxKind.TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -311732,7 +311741,7 @@ var ts; } // @api function createVoidExpression(expression) { - var node = createBaseExpression(217 /* SyntaxKind.VoidExpression */); + var node = createBaseExpression(219 /* SyntaxKind.VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -311745,7 +311754,7 @@ var ts; } // @api function createAwaitExpression(expression) { - var node = createBaseExpression(218 /* SyntaxKind.AwaitExpression */); + var node = createBaseExpression(220 /* SyntaxKind.AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -311762,7 +311771,7 @@ var ts; } // @api function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219 /* SyntaxKind.PrefixUnaryExpression */); + var node = createBaseExpression(221 /* SyntaxKind.PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -311784,7 +311793,7 @@ var ts; } // @api function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220 /* SyntaxKind.PostfixUnaryExpression */); + var node = createBaseExpression(222 /* SyntaxKind.PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -311805,7 +311814,7 @@ var ts; } // @api function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221 /* SyntaxKind.BinaryExpression */); + var node = createBaseExpression(223 /* SyntaxKind.BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -311877,7 +311886,7 @@ var ts; } // @api function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222 /* SyntaxKind.ConditionalExpression */); + var node = createBaseExpression(224 /* SyntaxKind.ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57 /* SyntaxKind.QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -311903,7 +311912,7 @@ var ts; } // @api function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223 /* SyntaxKind.TemplateExpression */); + var node = createBaseExpression(225 /* SyntaxKind.TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -311973,7 +311982,7 @@ var ts; // @api function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224 /* SyntaxKind.YieldExpression */); + var node = createBaseExpression(226 /* SyntaxKind.YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -311993,7 +312002,7 @@ var ts; } // @api function createSpreadElement(expression) { - var node = createBaseExpression(225 /* SyntaxKind.SpreadElement */); + var node = createBaseExpression(227 /* SyntaxKind.SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -312009,7 +312018,7 @@ var ts; } // @api function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -312025,11 +312034,11 @@ var ts; } // @api function createOmittedExpression() { - return createBaseExpression(227 /* SyntaxKind.OmittedExpression */); + return createBaseExpression(229 /* SyntaxKind.OmittedExpression */); } // @api function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228 /* SyntaxKind.ExpressionWithTypeArguments */); + var node = createBaseNode(230 /* SyntaxKind.ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -312047,7 +312056,7 @@ var ts; } // @api function createAsExpression(expression, type) { - var node = createBaseExpression(229 /* SyntaxKind.AsExpression */); + var node = createBaseExpression(231 /* SyntaxKind.AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= @@ -312065,7 +312074,7 @@ var ts; } // @api function createNonNullExpression(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -312082,8 +312091,26 @@ var ts; : node; } // @api + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235 /* SyntaxKind.SatisfiesExpression */); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1 /* TransformFlags.ContainsTypeScript */; + return node; + } + // @api + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } + // @api function createNonNullChain(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.transformFlags |= @@ -312100,7 +312127,7 @@ var ts; } // @api function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231 /* SyntaxKind.MetaProperty */); + var node = createBaseExpression(233 /* SyntaxKind.MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -312127,7 +312154,7 @@ var ts; // // @api function createTemplateSpan(expression, literal) { - var node = createBaseNode(233 /* SyntaxKind.TemplateSpan */); + var node = createBaseNode(236 /* SyntaxKind.TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -312145,7 +312172,7 @@ var ts; } // @api function createSemicolonClassElement() { - var node = createBaseNode(234 /* SyntaxKind.SemicolonClassElement */); + var node = createBaseNode(237 /* SyntaxKind.SemicolonClassElement */); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -312154,7 +312181,7 @@ var ts; // // @api function createBlock(statements, multiLine) { - var node = createBaseNode(235 /* SyntaxKind.Block */); + var node = createBaseNode(238 /* SyntaxKind.Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -312168,7 +312195,7 @@ var ts; } // @api function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237 /* SyntaxKind.VariableStatement */); + var node = createBaseDeclaration(240 /* SyntaxKind.VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -312188,11 +312215,11 @@ var ts; } // @api function createEmptyStatement() { - return createBaseNode(236 /* SyntaxKind.EmptyStatement */); + return createBaseNode(239 /* SyntaxKind.EmptyStatement */); } // @api function createExpressionStatement(expression) { - var node = createBaseNode(238 /* SyntaxKind.ExpressionStatement */); + var node = createBaseNode(241 /* SyntaxKind.ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -312205,7 +312232,7 @@ var ts; } // @api function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239 /* SyntaxKind.IfStatement */); + var node = createBaseNode(242 /* SyntaxKind.IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -312225,7 +312252,7 @@ var ts; } // @api function createDoStatement(statement, expression) { - var node = createBaseNode(240 /* SyntaxKind.DoStatement */); + var node = createBaseNode(243 /* SyntaxKind.DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -312242,7 +312269,7 @@ var ts; } // @api function createWhileStatement(expression, statement) { - var node = createBaseNode(241 /* SyntaxKind.WhileStatement */); + var node = createBaseNode(244 /* SyntaxKind.WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -312259,7 +312286,7 @@ var ts; } // @api function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242 /* SyntaxKind.ForStatement */); + var node = createBaseNode(245 /* SyntaxKind.ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -312282,7 +312309,7 @@ var ts; } // @api function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243 /* SyntaxKind.ForInStatement */); + var node = createBaseNode(246 /* SyntaxKind.ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -312302,7 +312329,7 @@ var ts; } // @api function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244 /* SyntaxKind.ForOfStatement */); + var node = createBaseNode(247 /* SyntaxKind.ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -312328,7 +312355,7 @@ var ts; } // @api function createContinueStatement(label) { - var node = createBaseNode(245 /* SyntaxKind.ContinueStatement */); + var node = createBaseNode(248 /* SyntaxKind.ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -312343,7 +312370,7 @@ var ts; } // @api function createBreakStatement(label) { - var node = createBaseNode(246 /* SyntaxKind.BreakStatement */); + var node = createBaseNode(249 /* SyntaxKind.BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -312358,7 +312385,7 @@ var ts; } // @api function createReturnStatement(expression) { - var node = createBaseNode(247 /* SyntaxKind.ReturnStatement */); + var node = createBaseNode(250 /* SyntaxKind.ReturnStatement */); node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= @@ -312375,7 +312402,7 @@ var ts; } // @api function createWithStatement(expression, statement) { - var node = createBaseNode(248 /* SyntaxKind.WithStatement */); + var node = createBaseNode(251 /* SyntaxKind.WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -312392,7 +312419,7 @@ var ts; } // @api function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249 /* SyntaxKind.SwitchStatement */); + var node = createBaseNode(252 /* SyntaxKind.SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -312409,7 +312436,7 @@ var ts; } // @api function createLabeledStatement(label, statement) { - var node = createBaseNode(250 /* SyntaxKind.LabeledStatement */); + var node = createBaseNode(253 /* SyntaxKind.LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -312426,7 +312453,7 @@ var ts; } // @api function createThrowStatement(expression) { - var node = createBaseNode(251 /* SyntaxKind.ThrowStatement */); + var node = createBaseNode(254 /* SyntaxKind.ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -312439,7 +312466,7 @@ var ts; } // @api function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252 /* SyntaxKind.TryStatement */); + var node = createBaseNode(255 /* SyntaxKind.TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -312459,11 +312486,11 @@ var ts; } // @api function createDebuggerStatement() { - return createBaseNode(253 /* SyntaxKind.DebuggerStatement */); + return createBaseNode(256 /* SyntaxKind.DebuggerStatement */); } // @api function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254 /* SyntaxKind.VariableDeclaration */, + var node = createBaseVariableLikeDeclaration(257 /* SyntaxKind.VariableDeclaration */, /*modifiers*/ undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); @@ -312484,7 +312511,7 @@ var ts; // @api function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseNode(255 /* SyntaxKind.VariableDeclarationList */); + var node = createBaseNode(258 /* SyntaxKind.VariableDeclarationList */); node.flags |= flags & 3 /* NodeFlags.BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -312505,7 +312532,7 @@ var ts; } // @api function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -312514,7 +312541,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304 /* TransformFlags.ContainsHoistedDeclarationOrCompletion */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -312551,7 +312578,7 @@ var ts; } // @api function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; } @@ -312575,7 +312602,7 @@ var ts; } // @api function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -312600,7 +312627,7 @@ var ts; } // @api function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -312624,7 +312651,7 @@ var ts; } // @api function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260 /* SyntaxKind.EnumDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(263 /* SyntaxKind.EnumDeclaration */, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -312651,7 +312678,7 @@ var ts; // @api function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseDeclaration(261 /* SyntaxKind.ModuleDeclaration */); + var node = createBaseDeclaration(264 /* SyntaxKind.ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 /* NodeFlags.Namespace */ | 4 /* NodeFlags.NestedNamespace */ | 1024 /* NodeFlags.GlobalAugmentation */); node.name = name; @@ -312687,7 +312714,7 @@ var ts; } // @api function createModuleBlock(statements) { - var node = createBaseNode(262 /* SyntaxKind.ModuleBlock */); + var node = createBaseNode(265 /* SyntaxKind.ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -312700,7 +312727,7 @@ var ts; } // @api function createCaseBlock(clauses) { - var node = createBaseNode(263 /* SyntaxKind.CaseBlock */); + var node = createBaseNode(266 /* SyntaxKind.CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -312713,7 +312740,7 @@ var ts; } // @api function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264 /* SyntaxKind.NamespaceExportDeclaration */, + var node = createBaseNamedDeclaration(267 /* SyntaxKind.NamespaceExportDeclaration */, /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -312736,7 +312763,7 @@ var ts; } // @api function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(268 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -312764,7 +312791,7 @@ var ts; } // @api function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266 /* SyntaxKind.ImportDeclaration */); + var node = createBaseDeclaration(269 /* SyntaxKind.ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -312794,7 +312821,7 @@ var ts; } // @api function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267 /* SyntaxKind.ImportClause */); + var node = createBaseNode(270 /* SyntaxKind.ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -312817,7 +312844,7 @@ var ts; } // @api function createAssertClause(elements, multiLine) { - var node = createBaseNode(293 /* SyntaxKind.AssertClause */); + var node = createBaseNode(296 /* SyntaxKind.AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -312832,7 +312859,7 @@ var ts; } // @api function createAssertEntry(name, value) { - var node = createBaseNode(294 /* SyntaxKind.AssertEntry */); + var node = createBaseNode(297 /* SyntaxKind.AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -312847,7 +312874,7 @@ var ts; } // @api function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295 /* SyntaxKind.ImportTypeAssertionContainer */); + var node = createBaseNode(298 /* SyntaxKind.ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -312861,7 +312888,7 @@ var ts; } // @api function createNamespaceImport(name) { - var node = createBaseNode(268 /* SyntaxKind.NamespaceImport */); + var node = createBaseNode(271 /* SyntaxKind.NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -312875,7 +312902,7 @@ var ts; } // @api function createNamespaceExport(name) { - var node = createBaseNode(274 /* SyntaxKind.NamespaceExport */); + var node = createBaseNode(277 /* SyntaxKind.NamespaceExport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -312891,7 +312918,7 @@ var ts; } // @api function createNamedImports(elements) { - var node = createBaseNode(269 /* SyntaxKind.NamedImports */); + var node = createBaseNode(272 /* SyntaxKind.NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -312905,7 +312932,7 @@ var ts; } // @api function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270 /* SyntaxKind.ImportSpecifier */); + var node = createBaseNode(273 /* SyntaxKind.ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -312925,7 +312952,7 @@ var ts; } // @api function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271 /* SyntaxKind.ExportAssignment */); + var node = createBaseDeclaration(274 /* SyntaxKind.ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -312952,7 +312979,7 @@ var ts; } // @api function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272 /* SyntaxKind.ExportDeclaration */); + var node = createBaseDeclaration(275 /* SyntaxKind.ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -312985,7 +313012,7 @@ var ts; } // @api function createNamedExports(elements) { - var node = createBaseNode(273 /* SyntaxKind.NamedExports */); + var node = createBaseNode(276 /* SyntaxKind.NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -312999,7 +313026,7 @@ var ts; } // @api function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275 /* SyntaxKind.ExportSpecifier */); + var node = createBaseNode(278 /* SyntaxKind.ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -313019,7 +313046,7 @@ var ts; } // @api function createMissingDeclaration() { - var node = createBaseDeclaration(276 /* SyntaxKind.MissingDeclaration */); + var node = createBaseDeclaration(279 /* SyntaxKind.MissingDeclaration */); return node; } // @@ -313027,7 +313054,7 @@ var ts; // // @api function createExternalModuleReference(expression) { - var node = createBaseNode(277 /* SyntaxKind.ExternalModuleReference */); + var node = createBaseNode(280 /* SyntaxKind.ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -313085,7 +313112,7 @@ var ts; } // @api function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317 /* SyntaxKind.JSDocFunctionType */, + var node = createBaseSignatureDeclaration(320 /* SyntaxKind.JSDocFunctionType */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); @@ -313101,7 +313128,7 @@ var ts; // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322 /* SyntaxKind.JSDocTypeLiteral */); + var node = createBaseNode(325 /* SyntaxKind.JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -313115,7 +313142,7 @@ var ts; } // @api function createJSDocTypeExpression(type) { - var node = createBaseNode(309 /* SyntaxKind.JSDocTypeExpression */); + var node = createBaseNode(312 /* SyntaxKind.JSDocTypeExpression */); node.type = type; return node; } @@ -313127,7 +313154,7 @@ var ts; } // @api function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323 /* SyntaxKind.JSDocSignature */); + var node = createBaseNode(326 /* SyntaxKind.JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -313156,7 +313183,7 @@ var ts; } // @api function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -313173,7 +313200,7 @@ var ts; } // @api function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -313191,7 +313218,7 @@ var ts; } // @api function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -313212,7 +313239,7 @@ var ts; } // @api function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -313233,7 +313260,7 @@ var ts; } // @api function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -313251,7 +313278,7 @@ var ts; } // @api function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -313266,13 +313293,13 @@ var ts; } // @api function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } // @api function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -313286,7 +313313,7 @@ var ts; } // @api function createJSDocNameReference(name) { - var node = createBaseNode(310 /* SyntaxKind.JSDocNameReference */); + var node = createBaseNode(313 /* SyntaxKind.JSDocNameReference */); node.name = name; return node; } @@ -313298,7 +313325,7 @@ var ts; } // @api function createJSDocMemberName(left, right) { - var node = createBaseNode(311 /* SyntaxKind.JSDocMemberName */); + var node = createBaseNode(314 /* SyntaxKind.JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= @@ -313315,7 +313342,7 @@ var ts; } // @api function createJSDocLink(name, text) { - var node = createBaseNode(324 /* SyntaxKind.JSDocLink */); + var node = createBaseNode(327 /* SyntaxKind.JSDocLink */); node.name = name; node.text = text; return node; @@ -313328,7 +313355,7 @@ var ts; } // @api function createJSDocLinkCode(name, text) { - var node = createBaseNode(325 /* SyntaxKind.JSDocLinkCode */); + var node = createBaseNode(328 /* SyntaxKind.JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -313341,7 +313368,7 @@ var ts; } // @api function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326 /* SyntaxKind.JSDocLinkPlain */); + var node = createBaseNode(329 /* SyntaxKind.JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -313413,7 +313440,7 @@ var ts; } // @api function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327 /* SyntaxKind.JSDocTag */, tagName, comment); + var node = createBaseJSDocTag(330 /* SyntaxKind.JSDocTag */, tagName, comment); return node; } // @api @@ -313425,7 +313452,7 @@ var ts; } // @api function createJSDocText(text) { - var node = createBaseNode(321 /* SyntaxKind.JSDocText */); + var node = createBaseNode(324 /* SyntaxKind.JSDocText */); node.text = text; return node; } @@ -313437,7 +313464,7 @@ var ts; } // @api function createJSDocComment(comment, tags) { - var node = createBaseNode(320 /* SyntaxKind.JSDoc */); + var node = createBaseNode(323 /* SyntaxKind.JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -313454,7 +313481,7 @@ var ts; // // @api function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278 /* SyntaxKind.JsxElement */); + var node = createBaseNode(281 /* SyntaxKind.JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -313475,7 +313502,7 @@ var ts; } // @api function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279 /* SyntaxKind.JsxSelfClosingElement */); + var node = createBaseNode(282 /* SyntaxKind.JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -313499,7 +313526,7 @@ var ts; } // @api function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280 /* SyntaxKind.JsxOpeningElement */); + var node = createBaseNode(283 /* SyntaxKind.JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -313523,7 +313550,7 @@ var ts; } // @api function createJsxClosingElement(tagName) { - var node = createBaseNode(281 /* SyntaxKind.JsxClosingElement */); + var node = createBaseNode(284 /* SyntaxKind.JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -313538,7 +313565,7 @@ var ts; } // @api function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282 /* SyntaxKind.JsxFragment */); + var node = createBaseNode(285 /* SyntaxKind.JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -313574,19 +313601,19 @@ var ts; } // @api function createJsxOpeningFragment() { - var node = createBaseNode(283 /* SyntaxKind.JsxOpeningFragment */); + var node = createBaseNode(286 /* SyntaxKind.JsxOpeningFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxJsxClosingFragment() { - var node = createBaseNode(284 /* SyntaxKind.JsxClosingFragment */); + var node = createBaseNode(287 /* SyntaxKind.JsxClosingFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxAttribute(name, initializer) { - var node = createBaseNode(285 /* SyntaxKind.JsxAttribute */); + var node = createBaseNode(288 /* SyntaxKind.JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -313604,7 +313631,7 @@ var ts; } // @api function createJsxAttributes(properties) { - var node = createBaseNode(286 /* SyntaxKind.JsxAttributes */); + var node = createBaseNode(289 /* SyntaxKind.JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -313619,7 +313646,7 @@ var ts; } // @api function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287 /* SyntaxKind.JsxSpreadAttribute */); + var node = createBaseNode(290 /* SyntaxKind.JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -313634,7 +313661,7 @@ var ts; } // @api function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288 /* SyntaxKind.JsxExpression */); + var node = createBaseNode(291 /* SyntaxKind.JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -313654,7 +313681,7 @@ var ts; // // @api function createCaseClause(expression, statements) { - var node = createBaseNode(289 /* SyntaxKind.CaseClause */); + var node = createBaseNode(292 /* SyntaxKind.CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -313671,7 +313698,7 @@ var ts; } // @api function createDefaultClause(statements) { - var node = createBaseNode(290 /* SyntaxKind.DefaultClause */); + var node = createBaseNode(293 /* SyntaxKind.DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -313684,7 +313711,7 @@ var ts; } // @api function createHeritageClause(token, types) { - var node = createBaseNode(291 /* SyntaxKind.HeritageClause */); + var node = createBaseNode(294 /* SyntaxKind.HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -313708,7 +313735,7 @@ var ts; } // @api function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292 /* SyntaxKind.CatchClause */); + var node = createBaseNode(295 /* SyntaxKind.CatchClause */); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, /*exclamationToken*/ undefined, @@ -313736,7 +313763,7 @@ var ts; // // @api function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296 /* SyntaxKind.PropertyAssignment */, + var node = createBaseNamedDeclaration(299 /* SyntaxKind.PropertyAssignment */, /*modifiers*/ undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -313768,7 +313795,7 @@ var ts; } // @api function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297 /* SyntaxKind.ShorthandPropertyAssignment */, + var node = createBaseNamedDeclaration(300 /* SyntaxKind.ShorthandPropertyAssignment */, /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= @@ -313802,7 +313829,7 @@ var ts; } // @api function createSpreadAssignment(expression) { - var node = createBaseNode(298 /* SyntaxKind.SpreadAssignment */); + var node = createBaseNode(301 /* SyntaxKind.SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -313821,7 +313848,7 @@ var ts; // // @api function createEnumMember(name, initializer) { - var node = createBaseNode(299 /* SyntaxKind.EnumMember */); + var node = createBaseNode(302 /* SyntaxKind.EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -313842,7 +313869,7 @@ var ts; // // @api function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */); + var node = baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -313859,7 +313886,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -313898,7 +313925,7 @@ var ts; // @api function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306 /* SyntaxKind.Bundle */); + var node = createBaseNode(309 /* SyntaxKind.Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -313913,7 +313940,7 @@ var ts; } // @api function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307 /* SyntaxKind.UnparsedSource */); + var node = createBaseNode(310 /* SyntaxKind.UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -313931,28 +313958,28 @@ var ts; } // @api function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300 /* SyntaxKind.UnparsedPrologue */, data); + return createBaseUnparsedNode(303 /* SyntaxKind.UnparsedPrologue */, data); } // @api function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301 /* SyntaxKind.UnparsedPrepend */, data); + var node = createBaseUnparsedNode(304 /* SyntaxKind.UnparsedPrepend */, data); node.texts = texts; return node; } // @api function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 /* SyntaxKind.UnparsedInternalText */ : 302 /* SyntaxKind.UnparsedText */, data); + return createBaseUnparsedNode(internal ? 306 /* SyntaxKind.UnparsedInternalText */ : 305 /* SyntaxKind.UnparsedText */, data); } // @api function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304 /* SyntaxKind.UnparsedSyntheticReference */); + var node = createBaseNode(307 /* SyntaxKind.UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } // @api function createInputFiles() { - var node = createBaseNode(308 /* SyntaxKind.InputFiles */); + var node = createBaseNode(311 /* SyntaxKind.InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; @@ -313963,7 +313990,7 @@ var ts; // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232 /* SyntaxKind.SyntheticExpression */); + var node = createBaseNode(234 /* SyntaxKind.SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; @@ -313971,7 +313998,7 @@ var ts; } // @api function createSyntaxList(children) { - var node = createBaseNode(348 /* SyntaxKind.SyntaxList */); + var node = createBaseNode(351 /* SyntaxKind.SyntaxList */); node._children = children; return node; } @@ -313986,7 +314013,7 @@ var ts; */ // @api function createNotEmittedStatement(original) { - var node = createBaseNode(349 /* SyntaxKind.NotEmittedStatement */); + var node = createBaseNode(352 /* SyntaxKind.NotEmittedStatement */); node.original = original; ts.setTextRange(node, original); return node; @@ -314000,7 +314027,7 @@ var ts; */ // @api function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350 /* SyntaxKind.PartiallyEmittedExpression */); + var node = createBaseNode(353 /* SyntaxKind.PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= @@ -314028,7 +314055,7 @@ var ts; } // @api function createCommaListExpression(elements) { - var node = createBaseNode(351 /* SyntaxKind.CommaListExpression */); + var node = createBaseNode(354 /* SyntaxKind.CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -314045,7 +314072,7 @@ var ts; */ // @api function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353 /* SyntaxKind.EndOfDeclarationMarker */); + var node = createBaseNode(356 /* SyntaxKind.EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -314056,14 +314083,14 @@ var ts; */ // @api function createMergeDeclarationMarker(original) { - var node = createBaseNode(352 /* SyntaxKind.MergeDeclarationMarker */); + var node = createBaseNode(355 /* SyntaxKind.MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; } // @api function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354 /* SyntaxKind.SyntheticReferenceExpression */); + var node = createBaseNode(357 /* SyntaxKind.SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -314085,7 +314112,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79 /* SyntaxKind.Identifier */) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -314094,7 +314121,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -314202,11 +314229,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 211 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); + case 213 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235 /* SyntaxKind.SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -314260,13 +314288,13 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: return false; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -314692,24 +314720,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343 /* SyntaxKind.JSDocTypeTag */: return "type"; - case 341 /* SyntaxKind.JSDocReturnTag */: return "returns"; - case 342 /* SyntaxKind.JSDocThisTag */: return "this"; - case 339 /* SyntaxKind.JSDocEnumTag */: return "enum"; - case 330 /* SyntaxKind.JSDocAuthorTag */: return "author"; - case 332 /* SyntaxKind.JSDocClassTag */: return "class"; - case 333 /* SyntaxKind.JSDocPublicTag */: return "public"; - case 334 /* SyntaxKind.JSDocPrivateTag */: return "private"; - case 335 /* SyntaxKind.JSDocProtectedTag */: return "protected"; - case 336 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; - case 337 /* SyntaxKind.JSDocOverrideTag */: return "override"; - case 344 /* SyntaxKind.JSDocTemplateTag */: return "template"; - case 345 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; - case 340 /* SyntaxKind.JSDocParameterTag */: return "param"; - case 347 /* SyntaxKind.JSDocPropertyTag */: return "prop"; - case 338 /* SyntaxKind.JSDocCallbackTag */: return "callback"; - case 328 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; - case 329 /* SyntaxKind.JSDocImplementsTag */: return "implements"; + case 346 /* SyntaxKind.JSDocTypeTag */: return "type"; + case 344 /* SyntaxKind.JSDocReturnTag */: return "returns"; + case 345 /* SyntaxKind.JSDocThisTag */: return "this"; + case 342 /* SyntaxKind.JSDocEnumTag */: return "enum"; + case 333 /* SyntaxKind.JSDocAuthorTag */: return "author"; + case 335 /* SyntaxKind.JSDocClassTag */: return "class"; + case 336 /* SyntaxKind.JSDocPublicTag */: return "public"; + case 337 /* SyntaxKind.JSDocPrivateTag */: return "private"; + case 338 /* SyntaxKind.JSDocProtectedTag */: return "protected"; + case 339 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; + case 340 /* SyntaxKind.JSDocOverrideTag */: return "override"; + case 347 /* SyntaxKind.JSDocTemplateTag */: return "template"; + case 348 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; + case 343 /* SyntaxKind.JSDocParameterTag */: return "param"; + case 350 /* SyntaxKind.JSDocPropertyTag */: return "prop"; + case 341 /* SyntaxKind.JSDocCallbackTag */: return "callback"; + case 331 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; + case 332 /* SyntaxKind.JSDocImplementsTag */: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -314725,11 +314753,9 @@ var ts; rawTextScanner.setText("`" + rawText + "`"); break; case 15 /* SyntaxKind.TemplateHead */: - // tslint:disable-next-line no-invalid-template-strings rawTextScanner.setText("`" + rawText + "${"); break; case 16 /* SyntaxKind.TemplateMiddle */: - // tslint:disable-next-line no-invalid-template-strings rawTextScanner.setText("}" + rawText + "${"); break; case 17 /* SyntaxKind.TemplateTail */: @@ -314789,69 +314815,70 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) { return -2 /* TransformFlags.TypeExcludes */; } switch (kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return -2147450880 /* TransformFlags.ArrayLiteralOrCallOrNewExcludes */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return -1941676032 /* TransformFlags.ModuleExcludes */; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return -2147483648 /* TransformFlags.ParameterExcludes */; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return -2072174592 /* TransformFlags.ArrowFunctionExcludes */; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return -1937940480 /* TransformFlags.FunctionExcludes */; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return -2146893824 /* TransformFlags.VariableDeclarationListExcludes */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return -2147344384 /* TransformFlags.ClassExcludes */; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return -1937948672 /* TransformFlags.ConstructorExcludes */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return -2013249536 /* TransformFlags.PropertyExcludes */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return -2005057536 /* TransformFlags.MethodOrAccessorExcludes */; - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 163 /* SyntaxKind.TypeParameter */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return -2 /* TransformFlags.TypeExcludes */; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return -2147278848 /* TransformFlags.ObjectLiteralExcludes */; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return -2147418112 /* TransformFlags.CatchClauseExcludes */; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return -2147450880 /* TransformFlags.BindingPatternExcludes */; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: case 106 /* SyntaxKind.SuperKeyword */: return -2147483648 /* TransformFlags.OuterExpressionExcludes */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return -2147483648 /* TransformFlags.PropertyAccessExcludes */; default: return -2147483648 /* TransformFlags.NodeExcludes */; @@ -315051,9 +315078,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -315086,7 +315114,6 @@ var ts; return node; } ts.createInputFiles = createInputFiles; - // tslint:disable-next-line variable-name var SourceMapSource; /** * Create an external source map source file reference @@ -315107,7 +315134,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; // We are using `.slice()` here in case `destEmitNode.leadingComments` is pushed to later. @@ -315133,6 +315160,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -315158,7 +315187,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -315876,6 +315905,8 @@ var ts; // - The verb (`next`, `throw`, or `return` method) to delegate to the expression // of a `yield*`. // - The result of evaluating the verb delegated to the expression of a `yield*`. + // g A temporary variable that holds onto the generator object until the generator + // is started, allowing it to also act as the `suspendedStart` state. // // functions: // verb(n) Creates a bound callback to the `step` function for opcode `n`. @@ -315914,7 +315945,7 @@ var ts; importName: "__generator", scoped: false, priority: 6, - text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; // ES Module Helpers ts.createBindingHelper = { @@ -316236,22 +316267,22 @@ var ts; ts.isExportModifier = isExportModifier; /* @internal */ function isAsyncModifier(node) { - return node.kind === 131 /* SyntaxKind.AsyncKeyword */; + return node.kind === 132 /* SyntaxKind.AsyncKeyword */; } ts.isAsyncModifier = isAsyncModifier; /* @internal */ function isAssertsKeyword(node) { - return node.kind === 128 /* SyntaxKind.AssertsKeyword */; + return node.kind === 129 /* SyntaxKind.AssertsKeyword */; } ts.isAssertsKeyword = isAssertsKeyword; /* @internal */ function isAwaitKeyword(node) { - return node.kind === 132 /* SyntaxKind.AwaitKeyword */; + return node.kind === 133 /* SyntaxKind.AwaitKeyword */; } ts.isAwaitKeyword = isAwaitKeyword; /* @internal */ function isReadonlyKeyword(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */; } ts.isReadonlyKeyword = isReadonlyKeyword; /* @internal */ @@ -316266,9 +316297,14 @@ var ts; ts.isAbstractModifier = isAbstractModifier; /* @internal */ function isOverrideModifier(node) { - return node.kind === 159 /* SyntaxKind.OverrideKeyword */; + return node.kind === 161 /* SyntaxKind.OverrideKeyword */; } ts.isOverrideModifier = isOverrideModifier; + /* @internal */ + function isAccessorModifier(node) { + return node.kind === 127 /* SyntaxKind.AccessorKeyword */; + } + ts.isAccessorModifier = isAccessorModifier; /*@internal*/ function isSuperKeyword(node) { return node.kind === 106 /* SyntaxKind.SuperKeyword */; @@ -316281,605 +316317,609 @@ var ts; ts.isImportKeyword = isImportKeyword; // Names function isQualifiedName(node) { - return node.kind === 161 /* SyntaxKind.QualifiedName */; + return node.kind === 163 /* SyntaxKind.QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return node.kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; // Signature elements function isTypeParameterDeclaration(node) { - return node.kind === 163 /* SyntaxKind.TypeParameter */; + return node.kind === 165 /* SyntaxKind.TypeParameter */; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; // TODO(rbuckton): Rename to 'isParameterDeclaration' function isParameter(node) { - return node.kind === 164 /* SyntaxKind.Parameter */; + return node.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } ts.isDecorator = isDecorator; // TypeMember function isPropertySignature(node) { - return node.kind === 166 /* SyntaxKind.PropertySignature */; + return node.kind === 168 /* SyntaxKind.PropertySignature */; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168 /* SyntaxKind.MethodSignature */; + return node.kind === 170 /* SyntaxKind.MethodSignature */; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171 /* SyntaxKind.Constructor */; + return node.kind === 173 /* SyntaxKind.Constructor */; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174 /* SyntaxKind.CallSignature */; + return node.kind === 176 /* SyntaxKind.CallSignature */; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175 /* SyntaxKind.ConstructSignature */; + return node.kind === 177 /* SyntaxKind.ConstructSignature */; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176 /* SyntaxKind.IndexSignature */; + return node.kind === 178 /* SyntaxKind.IndexSignature */; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; // Type function isTypePredicateNode(node) { - return node.kind === 177 /* SyntaxKind.TypePredicate */; + return node.kind === 179 /* SyntaxKind.TypePredicate */; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */; + return node.kind === 180 /* SyntaxKind.TypeReference */; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179 /* SyntaxKind.FunctionType */; + return node.kind === 181 /* SyntaxKind.FunctionType */; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180 /* SyntaxKind.ConstructorType */; + return node.kind === 182 /* SyntaxKind.ConstructorType */; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182 /* SyntaxKind.TypeLiteral */; + return node.kind === 184 /* SyntaxKind.TypeLiteral */; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183 /* SyntaxKind.ArrayType */; + return node.kind === 185 /* SyntaxKind.ArrayType */; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */; + return node.kind === 186 /* SyntaxKind.TupleType */; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197 /* SyntaxKind.NamedTupleMember */; + return node.kind === 199 /* SyntaxKind.NamedTupleMember */; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185 /* SyntaxKind.OptionalType */; + return node.kind === 187 /* SyntaxKind.OptionalType */; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186 /* SyntaxKind.RestType */; + return node.kind === 188 /* SyntaxKind.RestType */; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187 /* SyntaxKind.UnionType */; + return node.kind === 189 /* SyntaxKind.UnionType */; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188 /* SyntaxKind.IntersectionType */; + return node.kind === 190 /* SyntaxKind.IntersectionType */; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189 /* SyntaxKind.ConditionalType */; + return node.kind === 191 /* SyntaxKind.ConditionalType */; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190 /* SyntaxKind.InferType */; + return node.kind === 192 /* SyntaxKind.InferType */; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191 /* SyntaxKind.ParenthesizedType */; + return node.kind === 193 /* SyntaxKind.ParenthesizedType */; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192 /* SyntaxKind.ThisType */; + return node.kind === 194 /* SyntaxKind.ThisType */; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193 /* SyntaxKind.TypeOperator */; + return node.kind === 195 /* SyntaxKind.TypeOperator */; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194 /* SyntaxKind.IndexedAccessType */; + return node.kind === 196 /* SyntaxKind.IndexedAccessType */; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195 /* SyntaxKind.MappedType */; + return node.kind === 197 /* SyntaxKind.MappedType */; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196 /* SyntaxKind.LiteralType */; + return node.kind === 198 /* SyntaxKind.LiteralType */; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200 /* SyntaxKind.ImportType */; + return node.kind === 202 /* SyntaxKind.ImportType */; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */; + return node.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198 /* SyntaxKind.TemplateLiteralType */; + return node.kind === 200 /* SyntaxKind.TemplateLiteralType */; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return node.kind === 203 /* SyntaxKind.ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202 /* SyntaxKind.ArrayBindingPattern */; + return node.kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203 /* SyntaxKind.BindingElement */; + return node.kind === 205 /* SyntaxKind.BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; + return node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212 /* SyntaxKind.ParenthesizedExpression */; + return node.kind === 214 /* SyntaxKind.ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216 /* SyntaxKind.TypeOfExpression */; + return node.kind === 218 /* SyntaxKind.TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217 /* SyntaxKind.VoidExpression */; + return node.kind === 219 /* SyntaxKind.VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218 /* SyntaxKind.AwaitExpression */; + return node.kind === 220 /* SyntaxKind.AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */; + return node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220 /* SyntaxKind.PostfixUnaryExpression */; + return node.kind === 222 /* SyntaxKind.PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222 /* SyntaxKind.ConditionalExpression */; + return node.kind === 224 /* SyntaxKind.ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223 /* SyntaxKind.TemplateExpression */; + return node.kind === 225 /* SyntaxKind.TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224 /* SyntaxKind.YieldExpression */; + return node.kind === 226 /* SyntaxKind.YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225 /* SyntaxKind.SpreadElement */; + return node.kind === 227 /* SyntaxKind.SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226 /* SyntaxKind.ClassExpression */; + return node.kind === 228 /* SyntaxKind.ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227 /* SyntaxKind.OmittedExpression */; + return node.kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229 /* SyntaxKind.AsExpression */; + return node.kind === 231 /* SyntaxKind.AsExpression */; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235 /* SyntaxKind.SatisfiesExpression */; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230 /* SyntaxKind.NonNullExpression */; + return node.kind === 232 /* SyntaxKind.NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231 /* SyntaxKind.MetaProperty */; + return node.kind === 233 /* SyntaxKind.MetaProperty */; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232 /* SyntaxKind.SyntheticExpression */; + return node.kind === 234 /* SyntaxKind.SyntheticExpression */; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350 /* SyntaxKind.PartiallyEmittedExpression */; + return node.kind === 353 /* SyntaxKind.PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaListExpression = isCommaListExpression; // Misc function isTemplateSpan(node) { - return node.kind === 233 /* SyntaxKind.TemplateSpan */; + return node.kind === 236 /* SyntaxKind.TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234 /* SyntaxKind.SemicolonClassElement */; + return node.kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Elements function isBlock(node) { - return node.kind === 235 /* SyntaxKind.Block */; + return node.kind === 238 /* SyntaxKind.Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237 /* SyntaxKind.VariableStatement */; + return node.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236 /* SyntaxKind.EmptyStatement */; + return node.kind === 239 /* SyntaxKind.EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */; + return node.kind === 241 /* SyntaxKind.ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239 /* SyntaxKind.IfStatement */; + return node.kind === 242 /* SyntaxKind.IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240 /* SyntaxKind.DoStatement */; + return node.kind === 243 /* SyntaxKind.DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241 /* SyntaxKind.WhileStatement */; + return node.kind === 244 /* SyntaxKind.WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242 /* SyntaxKind.ForStatement */; + return node.kind === 245 /* SyntaxKind.ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247 /* SyntaxKind.ReturnStatement */; + return node.kind === 250 /* SyntaxKind.ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248 /* SyntaxKind.WithStatement */; + return node.kind === 251 /* SyntaxKind.WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249 /* SyntaxKind.SwitchStatement */; + return node.kind === 252 /* SyntaxKind.SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250 /* SyntaxKind.LabeledStatement */; + return node.kind === 253 /* SyntaxKind.LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251 /* SyntaxKind.ThrowStatement */; + return node.kind === 254 /* SyntaxKind.ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252 /* SyntaxKind.TryStatement */; + return node.kind === 255 /* SyntaxKind.TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253 /* SyntaxKind.DebuggerStatement */; + return node.kind === 256 /* SyntaxKind.DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255 /* SyntaxKind.VariableDeclarationList */; + return node.kind === 258 /* SyntaxKind.VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256 /* SyntaxKind.FunctionDeclaration */; + return node.kind === 259 /* SyntaxKind.FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257 /* SyntaxKind.ClassDeclaration */; + return node.kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return node.kind === 261 /* SyntaxKind.InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */; + return node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262 /* SyntaxKind.ModuleBlock */; + return node.kind === 265 /* SyntaxKind.ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263 /* SyntaxKind.CaseBlock */; + return node.kind === 266 /* SyntaxKind.CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */; + return node.kind === 270 /* SyntaxKind.ImportClause */; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295 /* SyntaxKind.ImportTypeAssertionContainer */; + return node.kind === 298 /* SyntaxKind.ImportTypeAssertionContainer */; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293 /* SyntaxKind.AssertClause */; + return node.kind === 296 /* SyntaxKind.AssertClause */; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294 /* SyntaxKind.AssertEntry */; + return node.kind === 297 /* SyntaxKind.AssertEntry */; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */; + return node.kind === 272 /* SyntaxKind.NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270 /* SyntaxKind.ImportSpecifier */; + return node.kind === 273 /* SyntaxKind.ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271 /* SyntaxKind.ExportAssignment */; + return node.kind === 274 /* SyntaxKind.ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272 /* SyntaxKind.ExportDeclaration */; + return node.kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275 /* SyntaxKind.ExportSpecifier */; + return node.kind === 278 /* SyntaxKind.ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276 /* SyntaxKind.MissingDeclaration */; + return node.kind === 279 /* SyntaxKind.MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349 /* SyntaxKind.NotEmittedStatement */; + return node.kind === 352 /* SyntaxKind.NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ function isSyntheticReference(node) { - return node.kind === 354 /* SyntaxKind.SyntheticReferenceExpression */; + return node.kind === 357 /* SyntaxKind.SyntheticReferenceExpression */; } ts.isSyntheticReference = isSyntheticReference; /* @internal */ function isMergeDeclarationMarker(node) { - return node.kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return node.kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; /* @internal */ function isEndOfDeclarationMarker(node) { - return node.kind === 353 /* SyntaxKind.EndOfDeclarationMarker */; + return node.kind === 356 /* SyntaxKind.EndOfDeclarationMarker */; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; // Module References function isExternalModuleReference(node) { - return node.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 278 /* SyntaxKind.JsxElement */; + return node.kind === 281 /* SyntaxKind.JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return node.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280 /* SyntaxKind.JsxOpeningElement */; + return node.kind === 283 /* SyntaxKind.JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281 /* SyntaxKind.JsxClosingElement */; + return node.kind === 284 /* SyntaxKind.JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282 /* SyntaxKind.JsxFragment */; + return node.kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283 /* SyntaxKind.JsxOpeningFragment */; + return node.kind === 286 /* SyntaxKind.JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284 /* SyntaxKind.JsxClosingFragment */; + return node.kind === 287 /* SyntaxKind.JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */; + return node.kind === 288 /* SyntaxKind.JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286 /* SyntaxKind.JsxAttributes */; + return node.kind === 289 /* SyntaxKind.JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288 /* SyntaxKind.JsxExpression */; + return node.kind === 291 /* SyntaxKind.JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 289 /* SyntaxKind.CaseClause */; + return node.kind === 292 /* SyntaxKind.CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290 /* SyntaxKind.DefaultClause */; + return node.kind === 293 /* SyntaxKind.DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291 /* SyntaxKind.HeritageClause */; + return node.kind === 294 /* SyntaxKind.HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 296 /* SyntaxKind.PropertyAssignment */; + return node.kind === 299 /* SyntaxKind.PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298 /* SyntaxKind.SpreadAssignment */; + return node.kind === 301 /* SyntaxKind.SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } ts.isEnumMember = isEnumMember; // Unparsed // TODO(rbuckton): isUnparsedPrologue function isUnparsedPrepend(node) { - return node.kind === 301 /* SyntaxKind.UnparsedPrepend */; + return node.kind === 304 /* SyntaxKind.UnparsedPrepend */; } ts.isUnparsedPrepend = isUnparsedPrepend; // TODO(rbuckton): isUnparsedText @@ -316887,176 +316927,176 @@ var ts; // TODO(rbuckton): isUnparsedSyntheticReference // Top-level nodes function isSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */; + return node.kind === 308 /* SyntaxKind.SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306 /* SyntaxKind.Bundle */; + return node.kind === 309 /* SyntaxKind.Bundle */; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307 /* SyntaxKind.UnparsedSource */; + return node.kind === 310 /* SyntaxKind.UnparsedSource */; } ts.isUnparsedSource = isUnparsedSource; // TODO(rbuckton): isInputFiles // JSDoc Elements function isJSDocTypeExpression(node) { - return node.kind === 309 /* SyntaxKind.JSDocTypeExpression */; + return node.kind === 312 /* SyntaxKind.JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310 /* SyntaxKind.JSDocNameReference */; + return node.kind === 313 /* SyntaxKind.JSDocNameReference */; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311 /* SyntaxKind.JSDocMemberName */; + return node.kind === 314 /* SyntaxKind.JSDocMemberName */; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */; + return node.kind === 327 /* SyntaxKind.JSDocLink */; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325 /* SyntaxKind.JSDocLinkCode */; + return node.kind === 328 /* SyntaxKind.JSDocLinkCode */; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312 /* SyntaxKind.JSDocAllType */; + return node.kind === 315 /* SyntaxKind.JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313 /* SyntaxKind.JSDocUnknownType */; + return node.kind === 316 /* SyntaxKind.JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314 /* SyntaxKind.JSDocNullableType */; + return node.kind === 317 /* SyntaxKind.JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315 /* SyntaxKind.JSDocNonNullableType */; + return node.kind === 318 /* SyntaxKind.JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return node.kind === 319 /* SyntaxKind.JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317 /* SyntaxKind.JSDocFunctionType */; + return node.kind === 320 /* SyntaxKind.JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319 /* SyntaxKind.JSDocNamepathType */; + return node.kind === 322 /* SyntaxKind.JSDocNamepathType */; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */; + return node.kind === 323 /* SyntaxKind.JSDoc */; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322 /* SyntaxKind.JSDocTypeLiteral */; + return node.kind === 325 /* SyntaxKind.JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323 /* SyntaxKind.JSDocSignature */; + return node.kind === 326 /* SyntaxKind.JSDocSignature */; } ts.isJSDocSignature = isJSDocSignature; // JSDoc Tags function isJSDocAugmentsTag(node) { - return node.kind === 328 /* SyntaxKind.JSDocAugmentsTag */; + return node.kind === 331 /* SyntaxKind.JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330 /* SyntaxKind.JSDocAuthorTag */; + return node.kind === 333 /* SyntaxKind.JSDocAuthorTag */; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332 /* SyntaxKind.JSDocClassTag */; + return node.kind === 335 /* SyntaxKind.JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338 /* SyntaxKind.JSDocCallbackTag */; + return node.kind === 341 /* SyntaxKind.JSDocCallbackTag */; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333 /* SyntaxKind.JSDocPublicTag */; + return node.kind === 336 /* SyntaxKind.JSDocPublicTag */; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334 /* SyntaxKind.JSDocPrivateTag */; + return node.kind === 337 /* SyntaxKind.JSDocPrivateTag */; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335 /* SyntaxKind.JSDocProtectedTag */; + return node.kind === 338 /* SyntaxKind.JSDocProtectedTag */; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336 /* SyntaxKind.JSDocReadonlyTag */; + return node.kind === 339 /* SyntaxKind.JSDocReadonlyTag */; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337 /* SyntaxKind.JSDocOverrideTag */; + return node.kind === 340 /* SyntaxKind.JSDocOverrideTag */; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331 /* SyntaxKind.JSDocDeprecatedTag */; + return node.kind === 334 /* SyntaxKind.JSDocDeprecatedTag */; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346 /* SyntaxKind.JSDocSeeTag */; + return node.kind === 349 /* SyntaxKind.JSDocSeeTag */; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341 /* SyntaxKind.JSDocReturnTag */; + return node.kind === 344 /* SyntaxKind.JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342 /* SyntaxKind.JSDocThisTag */; + return node.kind === 345 /* SyntaxKind.JSDocThisTag */; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343 /* SyntaxKind.JSDocTypeTag */; + return node.kind === 346 /* SyntaxKind.JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344 /* SyntaxKind.JSDocTemplateTag */; + return node.kind === 347 /* SyntaxKind.JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327 /* SyntaxKind.JSDocTag */; + return node.kind === 330 /* SyntaxKind.JSDocTag */; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329 /* SyntaxKind.JSDocImplementsTag */; + return node.kind === 332 /* SyntaxKind.JSDocImplementsTag */; } ts.isJSDocImplementsTag = isJSDocImplementsTag; // Synthesized list /* @internal */ function isSyntaxList(n) { - return n.kind === 348 /* SyntaxKind.SyntaxList */; + return n.kind === 351 /* SyntaxKind.SyntaxList */; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -317255,14 +317295,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -317370,8 +317410,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || - node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || + node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -317389,17 +317429,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15 /* OuterExpressionKinds.All */; } switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: if (kinds & 16 /* OuterExpressionKinds.ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* OuterExpressionKinds.Parentheses */) !== 0; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return (kinds & 2 /* OuterExpressionKinds.TypeAssertions */) !== 0; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return (kinds & 4 /* OuterExpressionKinds.NonNullAssertions */) !== 0; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return (kinds & 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */) !== 0; } return false; @@ -317520,10 +317561,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 /* SyntaxKind.ImportDeclaration */ && node.importClause) { + if (node.kind === 269 /* SyntaxKind.ImportDeclaration */ && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -317642,7 +317683,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -317654,11 +317695,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -317690,12 +317731,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 225 /* SyntaxKind.SpreadElement */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 227 /* SyntaxKind.SpreadElement */: + case 301 /* SyntaxKind.SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -317713,7 +317754,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -317728,7 +317769,7 @@ var ts; : propertyName; } break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -317743,7 +317784,7 @@ var ts; : propertyName; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); @@ -317766,13 +317807,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -317793,46 +317834,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 179 /* SyntaxKind.FunctionType */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 181 /* SyntaxKind.FunctionType */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -318106,6 +318147,83 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + /** + * Gets the node from which a name should be generated. + */ + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + // if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing. + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + // otherwise, return the original node for the source + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 /* CharacterCodes.hash */ ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + /** + * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. + */ + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + /** + * Creates a {@link GetAccessorDeclaration} that reads from a private backing field. + */ + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], + /*type*/ undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + /** + * Creates a {@link SetAccessorDeclaration} that writes to a private backing field. + */ + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotdotDotToken*/ undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -318115,47 +318233,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 180 /* SyntaxKind.ConstructorType */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 272 /* SyntaxKind.ExportDeclaration */; + return kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 182 /* SyntaxKind.ConstructorType */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 /* SyntaxKind.Parameter */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 257 /* SyntaxKind.ClassDeclaration */; + return kind === 166 /* SyntaxKind.Parameter */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var SignatureFlags; (function (SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; @@ -318243,6 +318362,718 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 /* SyntaxKind.ImportKeyword */ && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163 /* SyntaxKind.QualifiedName */] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165 /* SyntaxKind.TypeParameter */] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166 /* SyntaxKind.Parameter */] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168 /* SyntaxKind.PropertySignature */] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299 /* SyntaxKind.PropertyAssignment */] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205 /* SyntaxKind.BindingElement */] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181 /* SyntaxKind.FunctionType */] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176 /* SyntaxKind.CallSignature */] = forEachChildInCallOrConstructSignature, + _a[177 /* SyntaxKind.ConstructSignature */] = forEachChildInCallOrConstructSignature, + _a[171 /* SyntaxKind.MethodDeclaration */] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173 /* SyntaxKind.Constructor */] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180 /* SyntaxKind.TypeReference */] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179 /* SyntaxKind.TypePredicate */] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185 /* SyntaxKind.ArrayType */] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186 /* SyntaxKind.TupleType */] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189 /* SyntaxKind.UnionType */] = forEachChildInUnionOrIntersectionType, + _a[190 /* SyntaxKind.IntersectionType */] = forEachChildInUnionOrIntersectionType, + _a[191 /* SyntaxKind.ConditionalType */] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192 /* SyntaxKind.InferType */] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202 /* SyntaxKind.ImportType */] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195 /* SyntaxKind.TypeOperator */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196 /* SyntaxKind.IndexedAccessType */] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197 /* SyntaxKind.MappedType */] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198 /* SyntaxKind.LiteralType */] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203 /* SyntaxKind.ObjectBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210 /* SyntaxKind.CallExpression */] = forEachChildInCallOrNewExpression, + _a[211 /* SyntaxKind.NewExpression */] = forEachChildInCallOrNewExpression, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231 /* SyntaxKind.AsExpression */] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238 /* SyntaxKind.Block */] = forEachChildInBlock, + _a[265 /* SyntaxKind.ModuleBlock */] = forEachChildInBlock, + _a[308 /* SyntaxKind.SourceFile */] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242 /* SyntaxKind.IfStatement */] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243 /* SyntaxKind.DoStatement */] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245 /* SyntaxKind.ForStatement */] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = forEachChildInContinueOrBreakStatement, + _a[249 /* SyntaxKind.BreakStatement */] = forEachChildInContinueOrBreakStatement, + _a[250 /* SyntaxKind.ReturnStatement */] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251 /* SyntaxKind.WithStatement */] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292 /* SyntaxKind.CaseClause */] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255 /* SyntaxKind.TryStatement */] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295 /* SyntaxKind.CatchClause */] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167 /* SyntaxKind.Decorator */] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = forEachChildInClassDeclarationOrExpression, + _a[228 /* SyntaxKind.ClassExpression */] = forEachChildInClassDeclarationOrExpression, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302 /* SyntaxKind.EnumMember */] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270 /* SyntaxKind.ImportClause */] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296 /* SyntaxKind.AssertClause */] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272 /* SyntaxKind.NamedImports */] = forEachChildInNamedImportsOrExports, + _a[276 /* SyntaxKind.NamedExports */] = forEachChildInNamedImportsOrExports, + _a[275 /* SyntaxKind.ExportDeclaration */] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[278 /* SyntaxKind.ExportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[274 /* SyntaxKind.ExportAssignment */] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236 /* SyntaxKind.TemplateSpan */] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280 /* SyntaxKind.ExternalModuleReference */] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279 /* SyntaxKind.MissingDeclaration */] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281 /* SyntaxKind.JsxElement */] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283 /* SyntaxKind.JsxOpeningElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289 /* SyntaxKind.JsxAttributes */] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187 /* SyntaxKind.OptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188 /* SyntaxKind.RestType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312 /* SyntaxKind.JSDocTypeExpression */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318 /* SyntaxKind.JSDocNonNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317 /* SyntaxKind.JSDocNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319 /* SyntaxKind.JSDocOptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321 /* SyntaxKind.JSDocVariadicType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320 /* SyntaxKind.JSDocFunctionType */] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323 /* SyntaxKind.JSDoc */] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349 /* SyntaxKind.JSDocSeeTag */] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313 /* SyntaxKind.JSDocNameReference */] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314 /* SyntaxKind.JSDocMemberName */] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343 /* SyntaxKind.JSDocParameterTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[350 /* SyntaxKind.JSDocPropertyTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[333 /* SyntaxKind.JSDocAuthorTag */] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332 /* SyntaxKind.JSDocImplementsTag */] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331 /* SyntaxKind.JSDocAugmentsTag */] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347 /* SyntaxKind.JSDocTemplateTag */] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348 /* SyntaxKind.JSDocTypedefTag */] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341 /* SyntaxKind.JSDocCallbackTag */] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344 /* SyntaxKind.JSDocReturnTag */] = forEachChildInJSDocReturnTag, + _a[346 /* SyntaxKind.JSDocTypeTag */] = forEachChildInJSDocReturnTag, + _a[345 /* SyntaxKind.JSDocThisTag */] = forEachChildInJSDocReturnTag, + _a[342 /* SyntaxKind.JSDocEnumTag */] = forEachChildInJSDocReturnTag, + _a[326 /* SyntaxKind.JSDocSignature */] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327 /* SyntaxKind.JSDocLink */] = forEachChildInJSDocLinkCodeOrPlain, + _a[328 /* SyntaxKind.JSDocLinkCode */] = forEachChildInJSDocLinkCodeOrPlain, + _a[329 /* SyntaxKind.JSDocLinkPlain */] = forEachChildInJSDocLinkCodeOrPlain, + _a[325 /* SyntaxKind.JSDocTypeLiteral */] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330 /* SyntaxKind.JSDocTag */] = forEachChildInJSDocTag, + _a[335 /* SyntaxKind.JSDocClassTag */] = forEachChildInJSDocTag, + _a[336 /* SyntaxKind.JSDocPublicTag */] = forEachChildInJSDocTag, + _a[337 /* SyntaxKind.JSDocPrivateTag */] = forEachChildInJSDocTag, + _a[338 /* SyntaxKind.JSDocProtectedTag */] = forEachChildInJSDocTag, + _a[339 /* SyntaxKind.JSDocReadonlyTag */] = forEachChildInJSDocTag, + _a[334 /* SyntaxKind.JSDocDeprecatedTag */] = forEachChildInJSDocTag, + _a[340 /* SyntaxKind.JSDocOverrideTag */] = forEachChildInJSDocTag, + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = forEachChildInPartiallyEmittedExpression, + _a); + // shared + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + // TODO: should we separate these branches out? + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } /** * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -318257,563 +319088,11 @@ var ts; * that they appear in the source code. The language service depends on this property to locate nodes by position. */ function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node === undefined || node.kind <= 162 /* SyntaxKind.LastToken */) { return; } - switch (node.kind) { - case 161 /* SyntaxKind.QualifiedName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163 /* SyntaxKind.TypeParameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298 /* SyntaxKind.SpreadAssignment */: - return visitNode(cbNode, node.expression); - case 164 /* SyntaxKind.Parameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166 /* SyntaxKind.PropertySignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254 /* SyntaxKind.VariableDeclaration */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203 /* SyntaxKind.BindingElement */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180 /* SyntaxKind.ConstructorType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179 /* SyntaxKind.FunctionType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169 /* SyntaxKind.MethodDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168 /* SyntaxKind.MethodSignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172 /* SyntaxKind.GetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173 /* SyntaxKind.SetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213 /* SyntaxKind.FunctionExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214 /* SyntaxKind.ArrowFunction */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178 /* SyntaxKind.TypeReference */: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177 /* SyntaxKind.TypePredicate */: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181 /* SyntaxKind.TypeQuery */: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182 /* SyntaxKind.TypeLiteral */: - return visitNodes(cbNode, cbNodes, node.members); - case 183 /* SyntaxKind.ArrayType */: - return visitNode(cbNode, node.elementType); - case 184 /* SyntaxKind.TupleType */: - return visitNodes(cbNode, cbNodes, node.elements); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - return visitNodes(cbNode, cbNodes, node.types); - case 189 /* SyntaxKind.ConditionalType */: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190 /* SyntaxKind.InferType */: - return visitNode(cbNode, node.typeParameter); - case 200 /* SyntaxKind.ImportType */: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - return visitNode(cbNode, node.assertClause); - case 191 /* SyntaxKind.ParenthesizedType */: - case 193 /* SyntaxKind.TypeOperator */: - return visitNode(cbNode, node.type); - case 194 /* SyntaxKind.IndexedAccessType */: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195 /* SyntaxKind.MappedType */: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196 /* SyntaxKind.LiteralType */: - return visitNode(cbNode, node.literal); - case 197 /* SyntaxKind.NamedTupleMember */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - return visitNodes(cbNode, cbNodes, node.elements); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.properties); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211 /* SyntaxKind.TypeAssertionExpression */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212 /* SyntaxKind.ParenthesizedExpression */: - return visitNode(cbNode, node.expression); - case 215 /* SyntaxKind.DeleteExpression */: - return visitNode(cbNode, node.expression); - case 216 /* SyntaxKind.TypeOfExpression */: - return visitNode(cbNode, node.expression); - case 217 /* SyntaxKind.VoidExpression */: - return visitNode(cbNode, node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 224 /* SyntaxKind.YieldExpression */: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218 /* SyntaxKind.AwaitExpression */: - return visitNode(cbNode, node.expression); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 221 /* SyntaxKind.BinaryExpression */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229 /* SyntaxKind.AsExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230 /* SyntaxKind.NonNullExpression */: - return visitNode(cbNode, node.expression); - case 231 /* SyntaxKind.MetaProperty */: - return visitNode(cbNode, node.name); - case 222 /* SyntaxKind.ConditionalExpression */: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225 /* SyntaxKind.SpreadElement */: - return visitNode(cbNode, node.expression); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - return visitNodes(cbNode, cbNodes, node.statements); - case 305 /* SyntaxKind.SourceFile */: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255 /* SyntaxKind.VariableDeclarationList */: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitNode(cbNode, node.expression); - case 239 /* SyntaxKind.IfStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240 /* SyntaxKind.DoStatement */: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241 /* SyntaxKind.WhileStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242 /* SyntaxKind.ForStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243 /* SyntaxKind.ForInStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244 /* SyntaxKind.ForOfStatement */: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return visitNode(cbNode, node.label); - case 247 /* SyntaxKind.ReturnStatement */: - return visitNode(cbNode, node.expression); - case 248 /* SyntaxKind.WithStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249 /* SyntaxKind.SwitchStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263 /* SyntaxKind.CaseBlock */: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289 /* SyntaxKind.CaseClause */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290 /* SyntaxKind.DefaultClause */: - return visitNodes(cbNode, cbNodes, node.statements); - case 250 /* SyntaxKind.LabeledStatement */: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251 /* SyntaxKind.ThrowStatement */: - return visitNode(cbNode, node.expression); - case 252 /* SyntaxKind.TryStatement */: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292 /* SyntaxKind.CatchClause */: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165 /* SyntaxKind.Decorator */: - return visitNode(cbNode, node.expression); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299 /* SyntaxKind.EnumMember */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267 /* SyntaxKind.ImportClause */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293 /* SyntaxKind.AssertClause */: - return visitNodes(cbNode, cbNodes, node.elements); - case 294 /* SyntaxKind.AssertEntry */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268 /* SyntaxKind.NamespaceImport */: - return visitNode(cbNode, node.name); - case 274 /* SyntaxKind.NamespaceExport */: - return visitNode(cbNode, node.name); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: - return visitNodes(cbNode, cbNodes, node.elements); - case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223 /* SyntaxKind.TemplateExpression */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233 /* SyntaxKind.TemplateSpan */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198 /* SyntaxKind.TemplateLiteralType */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitNode(cbNode, node.expression); - case 291 /* SyntaxKind.HeritageClause */: - return visitNodes(cbNode, cbNodes, node.types); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277 /* SyntaxKind.ExternalModuleReference */: - return visitNode(cbNode, node.expression); - case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351 /* SyntaxKind.CommaListExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 278 /* SyntaxKind.JsxElement */: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282 /* SyntaxKind.JsxFragment */: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286 /* SyntaxKind.JsxAttributes */: - return visitNodes(cbNode, cbNodes, node.properties); - case 285 /* SyntaxKind.JsxAttribute */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - return visitNode(cbNode, node.expression); - case 288 /* SyntaxKind.JsxExpression */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281 /* SyntaxKind.JsxClosingElement */: - return visitNode(cbNode, node.tagName); - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - return visitNode(cbNode, node.type); - case 317 /* SyntaxKind.JSDocFunctionType */: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320 /* SyntaxKind.JSDoc */: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346 /* SyntaxKind.JSDocSeeTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310 /* SyntaxKind.JSDocNameReference */: - return visitNode(cbNode, node.name); - case 311 /* SyntaxKind.JSDocMemberName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330 /* SyntaxKind.JSDocAuthorTag */: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329 /* SyntaxKind.JSDocImplementsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344 /* SyntaxKind.JSDocTemplateTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345 /* SyntaxKind.JSDocTypedefTag */: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338 /* SyntaxKind.JSDocCallbackTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323 /* SyntaxKind.JSDocSignature */: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: - return visitNode(cbNode, node.name); - case 322 /* SyntaxKind.JSDocTypeLiteral */: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; /** @internal */ @@ -318860,7 +319139,7 @@ var ts; continue; return res; } - if (current.kind >= 161 /* SyntaxKind.FirstNode */) { + if (current.kind >= 163 /* SyntaxKind.FirstNode */) { // add children in reverse order to the queue, so popping gives the first child for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; @@ -318970,13 +319249,11 @@ var ts; var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true); var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks - // tslint:disable variable-name var NodeConstructor; var TokenConstructor; var IdentifierConstructor; var PrivateIdentifierConstructor; var SourceFileConstructor; - // tslint:enable variable-name function countNode(node) { nodeCount++; return node; @@ -319685,7 +319962,7 @@ var ts; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 132 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { return false; } return token() > 116 /* SyntaxKind.LastReservedWord */; @@ -319931,7 +320208,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", /*templateFlags*/ undefined) : kind === 8 /* SyntaxKind.NumericLiteral */ ? factory.createNumericLiteral("", /*numericLiteralFlags*/ undefined) : kind === 10 /* SyntaxKind.StringLiteral */ ? factory.createStringLiteral("", /*isSingleQuote*/ undefined) : - kind === 276 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : + kind === 279 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -319952,8 +320229,9 @@ var ts; // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker var originalKeywordKind = token(); var text = internIdentifier(scanner.getTokenValue()); + var hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape(); nextTokenWithoutCheck(); - return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind), pos); + return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind, hasExtendedUnicodeEscape), pos); } if (token() === 80 /* SyntaxKind.PrivateIdentifier */) { parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); @@ -320030,7 +320308,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -320054,15 +320332,16 @@ var ts; if (token() === 88 /* SyntaxKind.DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152 /* SyntaxKind.TypeKeyword */) { + if (token() === 154 /* SyntaxKind.TypeKeyword */) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88 /* SyntaxKind.DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -320071,7 +320350,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 /* SyntaxKind.AsteriskToken */ - && token() !== 127 /* SyntaxKind.AsKeyword */ + && token() !== 128 /* SyntaxKind.AsKeyword */ && token() !== 18 /* SyntaxKind.OpenBraceToken */ && canFollowModifier(); } @@ -320094,7 +320373,7 @@ var ts; return token() === 84 /* SyntaxKind.ClassKeyword */ || token() === 98 /* SyntaxKind.FunctionKeyword */ || token() === 118 /* SyntaxKind.InterfaceKeyword */ || (token() === 126 /* SyntaxKind.AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -320474,20 +320753,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 176 /* SyntaxKind.IndexSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 234 /* SyntaxKind.SemicolonClassElement */: + case 173 /* SyntaxKind.Constructor */: + case 178 /* SyntaxKind.IndexSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 237 /* SyntaxKind.SemicolonClassElement */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ && - methodDeclaration.name.originalKeywordKind === 134 /* SyntaxKind.ConstructorKeyword */; + methodDeclaration.name.originalKeywordKind === 135 /* SyntaxKind.ConstructorKeyword */; return !nameIsConstructor; } } @@ -320496,8 +320775,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return true; } } @@ -320506,58 +320785,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 238 /* SyntaxKind.ExpressionStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 236 /* SyntaxKind.EmptyStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 250 /* SyntaxKind.LabeledStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 174 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 176 /* SyntaxKind.CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind !== 257 /* SyntaxKind.VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -320578,7 +320857,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164 /* SyntaxKind.Parameter */) { + if (node.kind !== 166 /* SyntaxKind.Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -320871,14 +321150,14 @@ var ts; // If true, we should abort parsing an error function. function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return ts.nodeIsMissing(node.typeName); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: { + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -320957,7 +321236,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141 /* SyntaxKind.ModuleKeyword */)) { + if (parseOptional(142 /* SyntaxKind.ModuleKeyword */)) { // TODO(rbuckton): We never set the type for a JSDocNamepathType. What should we put here? var moduleTag = factory.createJSDocNamepathType(/*type*/ undefined); terminate: while (true) { @@ -321173,14 +321452,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175 /* SyntaxKind.ConstructSignature */) { + if (kind === 177 /* SyntaxKind.ConstructSignature */) { parseExpected(103 /* SyntaxKind.NewKeyword */); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4 /* SignatureFlags.Type */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ true); parseTypeMemberSemicolon(); - var node = kind === 174 /* SyntaxKind.CallSignature */ + var node = kind === 176 /* SyntaxKind.CallSignature */ ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -321274,8 +321553,8 @@ var ts; // Return true if we have the start of a signature member if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || - token() === 136 /* SyntaxKind.GetKeyword */ || - token() === 149 /* SyntaxKind.SetKeyword */) { + token() === 137 /* SyntaxKind.GetKeyword */ || + token() === 151 /* SyntaxKind.SetKeyword */) { return true; } var idToken = false; @@ -321307,19 +321586,19 @@ var ts; } function parseTypeMember() { if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */) { - return parseSignatureMember(174 /* SyntaxKind.CallSignature */); + return parseSignatureMember(176 /* SyntaxKind.CallSignature */); } if (token() === 103 /* SyntaxKind.NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175 /* SyntaxKind.ConstructSignature */); + return parseSignatureMember(177 /* SyntaxKind.ConstructSignature */); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 174 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 175 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); @@ -321360,9 +321639,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { - return nextToken() === 145 /* SyntaxKind.ReadonlyKeyword */; + return nextToken() === 146 /* SyntaxKind.ReadonlyKeyword */; } - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */) { nextToken(); } return token() === 22 /* SyntaxKind.OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 101 /* SyntaxKind.InKeyword */; @@ -321378,15 +321657,15 @@ var ts; var pos = getNodePos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var readonlyToken; - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - parseExpected(145 /* SyntaxKind.ReadonlyKeyword */); + if (readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + parseExpected(146 /* SyntaxKind.ReadonlyKeyword */); } } parseExpected(22 /* SyntaxKind.OpenBracketToken */); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; + var nameType = parseOptional(128 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; parseExpected(23 /* SyntaxKind.CloseBracketToken */); var questionToken; if (token() === 57 /* SyntaxKind.QuestionToken */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { @@ -321500,7 +321779,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); parseExpected(58 /* SyntaxKind.ColonToken */); var clause = parseAssertClause(/*skipAssertKeyword*/ true); if (!parseExpected(19 /* SyntaxKind.CloseBraceToken */)) { @@ -321533,16 +321812,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66 /* SyntaxKind.AsteriskEqualsToken */: @@ -321575,7 +321854,7 @@ var ts; return parseTokenNode(); case 108 /* SyntaxKind.ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -321592,7 +321871,7 @@ var ts; return parseParenthesizedType(); case 100 /* SyntaxKind.ImportKeyword */: return parseImportType(); - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15 /* SyntaxKind.TemplateHead */: return parseTemplateType(); @@ -321602,21 +321881,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 18 /* SyntaxKind.OpenBraceToken */: case 22 /* SyntaxKind.OpenBracketToken */: case 29 /* SyntaxKind.LessThanToken */: @@ -321628,14 +321907,14 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 41 /* SyntaxKind.AsteriskToken */: case 57 /* SyntaxKind.QuestionToken */: case 53 /* SyntaxKind.ExclamationToken */: case 25 /* SyntaxKind.DotDotDotToken */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 100 /* SyntaxKind.ImportKeyword */: - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: return true; @@ -321712,17 +321991,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137 /* SyntaxKind.InferKeyword */); + parseExpected(138 /* SyntaxKind.InferKeyword */); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: return parseTypeOperator(operator); - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -321842,16 +322121,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128 /* SyntaxKind.AssertsKeyword */); + var assertsModifier = parseExpectedToken(129 /* SyntaxKind.AssertsKeyword */); var parameterName = token() === 108 /* SyntaxKind.ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; + var type = parseOptional(140 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -321921,7 +322200,7 @@ var ts; case 45 /* SyntaxKind.PlusPlusToken */: case 46 /* SyntaxKind.MinusMinusToken */: case 29 /* SyntaxKind.LessThanToken */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: case 125 /* SyntaxKind.YieldKeyword */: case 80 /* SyntaxKind.PrivateIdentifier */: // Yield/await always starts an expression. Either it is an identifier (in which case @@ -322109,7 +322388,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 132 /* SyntaxKind.AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38 /* SyntaxKind.EqualsGreaterThanToken */) { @@ -322122,7 +322401,7 @@ var ts; return 0 /* Tristate.False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* Tristate.False */; @@ -322166,8 +322445,8 @@ var ts; // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (ts.isModifierKind(second) && second !== 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127 /* SyntaxKind.AsKeyword */) { + if (ts.isModifierKind(second) && second !== 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128 /* SyntaxKind.AsKeyword */) { // https://github.com/microsoft/TypeScript/issues/44466 return 0 /* Tristate.False */; } @@ -322249,7 +322528,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* Tristate.True */) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -322263,7 +322542,7 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" @@ -322329,7 +322608,7 @@ var ts; // // So we need just a bit of lookahead to ensure that it can only be a signature. var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191 /* SyntaxKind.ParenthesizedType */) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193 /* SyntaxKind.ParenthesizedType */) { unwrappedType = unwrappedType.type; // Skip parens if need be } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -322424,7 +322703,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 /* SyntaxKind.InKeyword */ || t === 160 /* SyntaxKind.OfKeyword */; + return t === 101 /* SyntaxKind.InKeyword */ || t === 162 /* SyntaxKind.OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -322462,7 +322741,7 @@ var ts; if (token() === 101 /* SyntaxKind.InKeyword */ && inDisallowInContext()) { break; } - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */ || token() === 150 /* SyntaxKind.SatisfiesKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -322472,8 +322751,10 @@ var ts; break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 /* SyntaxKind.SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -322488,6 +322769,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -322511,7 +322795,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -322564,7 +322848,7 @@ var ts; if (token() === 42 /* SyntaxKind.AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -322605,7 +322889,7 @@ var ts; // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -322635,7 +322919,7 @@ var ts; case 89 /* SyntaxKind.DeleteKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: return false; case 29 /* SyntaxKind.LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression @@ -322818,11 +323102,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (opening.kind === 283 /* SyntaxKind.JsxOpeningElement */) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 /* SyntaxKind.JsxElement */ + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { // when an unclosed JsxOpeningElement incorrectly parses its parent's JsxClosingElement, @@ -322848,11 +323132,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283 /* SyntaxKind.JsxOpeningFragment */) { + else if (opening.kind === 286 /* SyntaxKind.JsxOpeningFragment */) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279 /* SyntaxKind.JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 282 /* SyntaxKind.JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -322922,7 +323206,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 /* SyntaxKind.JsxElement */ + && (child === null || child === void 0 ? void 0 : child.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { // stop after parsing a mismatched child like
...(
) in order to reattach the higher @@ -323167,7 +323451,7 @@ var ts; } if (isTemplateStartOfTaggedTemplate()) { // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments - expression = !questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? + expression = !questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined); continue; @@ -323214,7 +323498,7 @@ var ts; } if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) { // Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments - if (!questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (!questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -323300,7 +323584,7 @@ var ts; return parseArrayLiteralExpression(); case 18 /* SyntaxKind.OpenBraceToken */: return parseObjectLiteralExpression(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -323367,11 +323651,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); var tokenIsIdentifier = isIdentifier(); @@ -323459,7 +323743,7 @@ var ts; var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false); var typeArguments; // Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -323563,7 +323847,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97 /* SyntaxKind.ForKeyword */); - var awaitToken = parseOptionalToken(132 /* SyntaxKind.AwaitKeyword */); + var awaitToken = parseOptionalToken(133 /* SyntaxKind.AwaitKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var initializer; if (token() !== 26 /* SyntaxKind.SemicolonToken */) { @@ -323575,7 +323859,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160 /* SyntaxKind.OfKeyword */) : parseOptional(160 /* SyntaxKind.OfKeyword */)) { + if (awaitToken ? parseExpected(162 /* SyntaxKind.OfKeyword */) : parseOptional(162 /* SyntaxKind.OfKeyword */)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); }); parseExpected(21 /* SyntaxKind.CloseParenToken */); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -323602,10 +323886,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); + parseExpected(kind === 249 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 /* SyntaxKind.BreakStatement */ + var node = kind === 249 /* SyntaxKind.BreakStatement */ ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -323796,25 +324080,26 @@ var ts; // // could be legal, it would add complexity for very little gain. case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: nextToken(); return token() === 18 /* SyntaxKind.OpenBraceToken */ || token() === 79 /* SyntaxKind.Identifier */ || token() === 93 /* SyntaxKind.ExportKeyword */; case 100 /* SyntaxKind.ImportKeyword */: @@ -323823,12 +324108,12 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); case 93 /* SyntaxKind.ExportKeyword */: var currentToken_1 = nextToken(); - if (currentToken_1 === 152 /* SyntaxKind.TypeKeyword */) { + if (currentToken_1 === 154 /* SyntaxKind.TypeKeyword */) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 /* SyntaxKind.EqualsToken */ || currentToken_1 === 41 /* SyntaxKind.AsteriskToken */ || currentToken_1 === 18 /* SyntaxKind.OpenBraceToken */ || currentToken_1 === 88 /* SyntaxKind.DefaultKeyword */ || - currentToken_1 === 127 /* SyntaxKind.AsKeyword */) { + currentToken_1 === 128 /* SyntaxKind.AsKeyword */) { return true; } continue; @@ -323876,20 +324161,21 @@ var ts; case 85 /* SyntaxKind.ConstKeyword */: case 93 /* SyntaxKind.ExportKeyword */: return isStartOfDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; + case 127 /* SyntaxKind.AccessorKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -323932,9 +324218,9 @@ var ts; case 97 /* SyntaxKind.ForKeyword */: return parseForOrForInOrForOfStatement(); case 86 /* SyntaxKind.ContinueKeyword */: - return parseBreakOrContinueStatement(245 /* SyntaxKind.ContinueStatement */); + return parseBreakOrContinueStatement(248 /* SyntaxKind.ContinueStatement */); case 81 /* SyntaxKind.BreakKeyword */: - return parseBreakOrContinueStatement(246 /* SyntaxKind.BreakStatement */); + return parseBreakOrContinueStatement(249 /* SyntaxKind.BreakStatement */); case 105 /* SyntaxKind.ReturnKeyword */: return parseReturnStatement(); case 116 /* SyntaxKind.WithKeyword */: @@ -323953,12 +324239,12 @@ var ts; return parseDebuggerStatement(); case 59 /* SyntaxKind.AtToken */: return parseDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 93 /* SyntaxKind.ExportKeyword */: @@ -323967,9 +324253,10 @@ var ts; case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -323978,7 +324265,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */; + return modifier.kind === 136 /* SyntaxKind.DeclareKeyword */; } function parseDeclaration() { // `parseListElement` attempted to get the reused node at this position, @@ -324024,13 +324311,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118 /* SyntaxKind.InterfaceKeyword */: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92 /* SyntaxKind.EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157 /* SyntaxKind.GlobalKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100 /* SyntaxKind.ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -324040,7 +324327,7 @@ var ts; case 88 /* SyntaxKind.DefaultKeyword */: case 63 /* SyntaxKind.EqualsToken */: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -324049,7 +324336,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -324175,7 +324462,7 @@ var ts; // this context. // The checker will then give an error that there is an empty declaration list. var declarations; - if (token() === 160 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -324203,9 +324490,9 @@ var ts; parseExpected(98 /* SyntaxKind.FunctionKeyword */); var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); // We don't parse the name here in await context, instead we will report a grammar error in the checker. - var name = modifierFlags & 512 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 /* SignatureFlags.Yield */ : 0 /* SignatureFlags.None */; - var isAsync = modifierFlags & 256 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; + var isAsync = modifierFlags & 512 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; var typeParameters = parseTypeParameters(); if (modifierFlags & 1 /* ModifierFlags.Export */) setAwaitContext(/*value*/ true); @@ -324218,8 +324505,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134 /* SyntaxKind.ConstructorKeyword */) { - return parseExpected(134 /* SyntaxKind.ConstructorKeyword */); + if (token() === 135 /* SyntaxKind.ConstructorKeyword */) { + return parseExpected(135 /* SyntaxKind.ConstructorKeyword */); } if (token() === 10 /* SyntaxKind.StringLiteral */ && lookAhead(nextToken) === 20 /* SyntaxKind.OpenParenToken */) { return tryParse(function () { @@ -324281,7 +324568,7 @@ var ts; var parameters = parseParameters(0 /* SignatureFlags.None */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 /* SyntaxKind.GetAccessor */ + var node = kind === 174 /* SyntaxKind.GetAccessor */ ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors @@ -324325,7 +324612,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 149 /* SyntaxKind.SetKeyword */ || idToken === 136 /* SyntaxKind.GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 151 /* SyntaxKind.SetKeyword */ || idToken === 137 /* SyntaxKind.GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -324368,7 +324655,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (inAwaitContext() && token() === 133 /* SyntaxKind.AwaitKeyword */) { // `@await` is is disallowed in an [Await] context, but can cause parsing to go off the rails // This simply parses the missing identifier and moves on. var pos = getNodePos(); @@ -324446,10 +324733,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131 /* SyntaxKind.AsyncKeyword */), pos); + var modifier = finishNode(factory.createToken(132 /* SyntaxKind.AsyncKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -324466,13 +324753,13 @@ var ts; if (token() === 124 /* SyntaxKind.StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } - if (token() === 134 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { + if (token() === 135 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -324509,10 +324796,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 226 /* SyntaxKind.ClassExpression */); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 228 /* SyntaxKind.ClassExpression */); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257 /* SyntaxKind.ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260 /* SyntaxKind.ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -324534,7 +324821,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 /* SyntaxKind.ClassDeclaration */ + var node = kind === 260 /* SyntaxKind.ClassDeclaration */ ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -324571,7 +324858,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -324598,11 +324885,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152 /* SyntaxKind.TypeKeyword */); + parseExpected(154 /* SyntaxKind.TypeKeyword */); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63 /* SyntaxKind.EqualsToken */); - var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -324661,7 +324948,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // parse 'global' as name of global scope augmentation name = parseIdentifier(); flags |= 1024 /* NodeFlags.GlobalAugmentation */; @@ -324683,15 +324970,15 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142 /* SyntaxKind.NamespaceKeyword */)) { + else if (parseOptional(143 /* SyntaxKind.NamespaceKeyword */)) { flags |= 16 /* NodeFlags.Namespace */; } else { - parseExpected(141 /* SyntaxKind.ModuleKeyword */); + parseExpected(142 /* SyntaxKind.ModuleKeyword */); if (token() === 10 /* SyntaxKind.StringLiteral */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -324699,7 +324986,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 /* SyntaxKind.RequireKeyword */ && + return token() === 147 /* SyntaxKind.RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -324712,8 +324999,8 @@ var ts; return nextToken() === 43 /* SyntaxKind.SlashToken */; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127 /* SyntaxKind.AsKeyword */); - parseExpected(142 /* SyntaxKind.NamespaceKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); + parseExpected(143 /* SyntaxKind.NamespaceKeyword */); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -324731,7 +325018,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 /* SyntaxKind.FromKeyword */ && + if (token() !== 158 /* SyntaxKind.FromKeyword */ && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -324749,11 +325036,11 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ // import { ) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -324771,7 +325058,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18 /* SyntaxKind.OpenBraceToken */)) { @@ -324796,7 +325083,7 @@ var ts; function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { // In `import id ___`, the current token decides whether to produce // an ImportDeclaration or ImportEqualsDeclaration. - return token() === 27 /* SyntaxKind.CommaToken */ || token() === 156 /* SyntaxKind.FromKeyword */; + return token() === 27 /* SyntaxKind.CommaToken */ || token() === 158 /* SyntaxKind.FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63 /* SyntaxKind.EqualsToken */); @@ -324819,7 +325106,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27 /* SyntaxKind.CommaToken */)) { - namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(269 /* SyntaxKind.NamedImports */); + namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(272 /* SyntaxKind.NamedImports */); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -324830,7 +325117,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146 /* SyntaxKind.RequireKeyword */); + parseExpected(147 /* SyntaxKind.RequireKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var expression = parseModuleSpecifier(); parseExpected(21 /* SyntaxKind.CloseParenToken */); @@ -324854,7 +325141,7 @@ var ts; // * as ImportedBinding var pos = getNodePos(); parseExpected(41 /* SyntaxKind.AsteriskToken */); - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } @@ -324867,17 +325154,17 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - var node = kind === 269 /* SyntaxKind.NamedImports */ + var node = kind === 272 /* SyntaxKind.NamedImports */ ? factory.createNamedImports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)) : factory.createNamedExports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275 /* SyntaxKind.ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278 /* SyntaxKind.ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270 /* SyntaxKind.ImportSpecifier */); + return parseImportOrExportSpecifier(273 /* SyntaxKind.ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -324902,10 +325189,10 @@ var ts; // import { type as } from "mod"; - isTypeOnly: true, name: as // import { type as as } from "mod"; - isTypeOnly: false, name: as, propertyName: type // import { type as as as } from "mod"; - isTypeOnly: true, name: as, propertyName: as - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as ...? } var firstAs = parseIdentifierName(); - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as as ...? } var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { @@ -324940,15 +325227,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127 /* SyntaxKind.AsKeyword */) { + if (canParseAsKeyword && token() === 128 /* SyntaxKind.AsKeyword */) { propertyName = name; - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 270 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 273 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 /* SyntaxKind.ImportSpecifier */ + var node = kind === 273 /* SyntaxKind.ImportSpecifier */ ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -324968,26 +325255,26 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152 /* SyntaxKind.TypeKeyword */); + var isTypeOnly = parseOptional(154 /* SyntaxKind.TypeKeyword */); var namespaceExportPos = getNodePos(); if (parseOptional(41 /* SyntaxKind.AsteriskToken */)) { - if (parseOptional(127 /* SyntaxKind.AsKeyword */)) { + if (parseOptional(128 /* SyntaxKind.AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273 /* SyntaxKind.NamedExports */); + exportClause = parseNamedImportsOrExports(276 /* SyntaxKind.NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 156 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(156 /* SyntaxKind.FromKeyword */); + if (token() === 158 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -325600,9 +325887,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -325634,12 +325921,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) { + if (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -325757,7 +326044,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343 /* SyntaxKind.JSDocTypeTag */) { + if (child.kind === 346 /* SyntaxKind.JSDocTypeTag */) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -325774,7 +326061,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */; + var isArrayType = typeExpression && typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -325826,7 +326113,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59 /* SyntaxKind.AtToken */)) { var tag = parseTag(indent); - if (tag && tag.kind === 341 /* SyntaxKind.JSDocReturnTag */) { + if (tag && tag.kind === 344 /* SyntaxKind.JSDocReturnTag */) { return tag; } } @@ -325861,7 +326148,7 @@ var ts; case 59 /* SyntaxKind.AtToken */: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) && + if (child && (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) && target !== 4 /* PropertyLikeParse.CallbackParameter */ && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -326831,6 +327118,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -326951,6 +327239,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -326959,6 +327248,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -328690,7 +328981,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (rootExpression && rootExpression.kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); // Last-ditch error recovery. Somewhat useful because the JSON parser will recover from some parse errors by // synthesizing a top-level array literal expression. There's a reasonable chance the first element of that @@ -328730,7 +329021,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (element.kind !== 299 /* SyntaxKind.PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -328824,13 +329115,13 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (valueExpression.operator !== 40 /* SyntaxKind.MinusToken */ || valueExpression.operand.kind !== 8 /* SyntaxKind.NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -328847,7 +329138,7 @@ var ts; return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined)); } - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -329079,12 +329370,23 @@ var ts; } function writeConfigurations() { // Filter applicable options to place in the file - var categorizedOptions = ts.createMultiMap(); + var categorizedOptions = new ts.Map(); + // Set allowed categories in order + categorizedOptions.set(ts.Diagnostics.Projects, []); + categorizedOptions.set(ts.Diagnostics.Language_and_Environment, []); + categorizedOptions.set(ts.Diagnostics.Modules, []); + categorizedOptions.set(ts.Diagnostics.JavaScript_Support, []); + categorizedOptions.set(ts.Diagnostics.Emit, []); + categorizedOptions.set(ts.Diagnostics.Interop_Constraints, []); + categorizedOptions.set(ts.Diagnostics.Type_Checking, []); + categorizedOptions.set(ts.Diagnostics.Completeness, []); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; - var category = option.category; if (isAllowedOptionForOutput(option)) { - categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); + var listForCategory = categorizedOptions.get(option.category); + if (!listForCategory) + categorizedOptions.set(option.category, listForCategory = []); + listForCategory.push(option); } } // Serialize all options and their descriptions @@ -329095,7 +329397,7 @@ var ts; if (entries.length !== 0) { entries.push({ value: "" }); } - entries.push({ value: "/* ".concat(category, " */") }); + entries.push({ value: "/* ".concat(ts.getLocaleSpecificMessage(category), " */") }); for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { var option = options_1[_i]; var optionName = void 0; @@ -330031,7 +330333,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { // Ignore unknown options out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -331137,6 +331439,9 @@ var ts; requestContainingDirectory: containingDirectory, reportDiagnostic: function (diag) { return void diagnostics.push(diag); }, }; + if (traceEnabled && ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) <= ts.ModuleResolutionKind.NodeNext) { + trace(host, ts.Diagnostics.Resolving_in_0_mode_with_conditions_1, features & NodeResolutionFeatures.EsmMode ? "ESM" : "CJS", conditions.map(function (c) { return "'".concat(c, "'"); }).join(", ")); + } var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); }); return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache); function tryResolve(extensions) { @@ -331726,7 +332031,7 @@ var ts; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false); - return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false); + return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false, "."); } } else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { @@ -331806,7 +332111,7 @@ var ts; var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports); if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) { var target = lookupTable[moduleName]; - return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false); + return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false, moduleName); } var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys); for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) { @@ -331815,17 +332120,17 @@ var ts; var target = lookupTable[potentialTarget]; var starPos = potentialTarget.indexOf("*"); var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos)); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget); } else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length - 1); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget); } else if (ts.startsWith(moduleName, potentialTarget)) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false, potentialTarget); } } function matchesPatternWithTrailer(target, name) { @@ -331842,7 +332147,7 @@ var ts; */ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) { return loadModuleFromTargetImportOrExport; - function loadModuleFromTargetImportOrExport(target, subpath, pattern) { + function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) { if (typeof target === "string") { if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) { if (state.traceEnabled) { @@ -331853,6 +332158,8 @@ var ts; if (!ts.startsWith(target, "./")) { if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) { var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath; + traceIfEnabled(state, ts.Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup); + traceIfEnabled(state, ts.Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/"); var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference); return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined); } @@ -331879,6 +332186,9 @@ var ts; } return toSearchResult(/*value*/ undefined); } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath); + } var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath); var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports); if (inputLink) @@ -331888,14 +332198,18 @@ var ts; else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null if (!Array.isArray(target)) { for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) { - var key = _a[_i]; - if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) { - var subTarget = target[key]; - var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern); + var condition = _a[_i]; + if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) { + traceIfEnabled(state, ts.Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition); + var subTarget = target[condition]; + var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key); if (result) { return result; } } + else { + traceIfEnabled(state, ts.Diagnostics.Saw_non_matching_condition_0, condition); + } } return undefined; } @@ -331908,7 +332222,7 @@ var ts; } for (var _b = 0, target_2 = target; _b < target_2.length; _b++) { var elem = target_2[_b]; - var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern); + var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key); if (result) { return result; } @@ -332103,6 +332417,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); @@ -332117,13 +332432,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them) - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -332136,19 +332445,24 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; - if (rest !== "") { // If "rest" is empty, we just did this search above. - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); - // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); + if (rest !== "") { + // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them) + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -332324,6 +332638,15 @@ var ts; function toSearchResult(value) { return value !== undefined ? { value: value } : undefined; } + function traceIfEnabled(state, diagnostic) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (state.traceEnabled) { + trace.apply(void 0, __spreadArray([state.host, diagnostic], args, false)); + } + } })(ts || (ts = {})); /* @internal */ var ts; @@ -332358,26 +332681,26 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return 0 /* ModuleInstanceState.NonInstantiated */; // 2. const enum declarations - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (ts.isEnumConst(node)) { return 2 /* ModuleInstanceState.ConstEnumOnly */; } break; // 3. non-exported import declarations - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (!(ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */))) { return 0 /* ModuleInstanceState.NonInstantiated */; } break; // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273 /* SyntaxKind.NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276 /* SyntaxKind.NamedExports */) { var state = 0 /* ModuleInstanceState.NonInstantiated */; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -332393,7 +332716,7 @@ var ts; } break; // 5. other uninstantiated module declarations. - case 262 /* SyntaxKind.ModuleBlock */: { + case 265 /* SyntaxKind.ModuleBlock */: { var state_1 = 0 /* ModuleInstanceState.NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -332415,7 +332738,7 @@ var ts; }); return state_1; } - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(node, visited); case 79 /* SyntaxKind.Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -332616,7 +332939,7 @@ var ts; // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) { return node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; } var name = ts.getNameOfDeclaration(node); @@ -332625,7 +332948,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { var nameExpression = name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteralLike(nameExpression)) { @@ -332651,36 +332974,36 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "__constructor" /* InternalSymbolName.Constructor */; - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return "__call" /* InternalSymbolName.Call */; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return "__new" /* InternalSymbolName.New */; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "__index" /* InternalSymbolName.Index */; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return "__export" /* InternalSymbolName.ExportStar */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // json file should behave as // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */) { // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* InternalSymbolName.New */ : "__call" /* InternalSymbolName.Call */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -332699,7 +333022,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; // The exported symbol for an export default function/class node is always named "default" var name = isComputedName ? "__computed" /* InternalSymbolName.Computed */ : isDefaultExport && parent ? "default" /* InternalSymbolName.Default */ @@ -332782,7 +333105,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { + (node.kind === 274 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -332821,7 +333144,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* SymbolFlags.Alias */) { - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */ || (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */ || (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -332846,7 +333169,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64 /* NodeFlags.ExportContext */)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } var exportKind = symbolFlags & 111551 /* SymbolFlags.Value */ ? 1048576 /* SymbolFlags.ExportValue */ : 0; @@ -332910,7 +333233,7 @@ var ts; // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. if (containerFlags & 1 /* ContainerFlags.IsContainer */) { - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -332932,10 +333255,10 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 /* ContainerFlags.IsFunctionExpression */ && - !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Async */) && + !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Async */) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. if (!isImmediatelyInvoked) { @@ -332946,7 +333269,7 @@ var ts; } // We create a return control flow graph for IIFEs and constructors. For constructors // we use the return control flow graph in strict property initialization checks. - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -332961,14 +333284,14 @@ var ts; node.flags |= 512 /* NodeFlags.HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 /* SyntaxKind.Constructor */ || node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */))) { + if (node.kind === 173 /* SyntaxKind.Constructor */ || node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */))) { node.returnFlowNode = currentFlow; } } @@ -332995,8 +333318,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -333019,59 +333342,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 /* SyntaxKind.FirstStatement */ && node.kind <= 253 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 240 /* SyntaxKind.FirstStatement */ && node.kind <= 256 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: bindWhileStatement(node); break; - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: bindDoStatement(node); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: bindForStatement(node); break; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: bindForInOrForOfStatement(node); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: bindIfStatement(node); break; - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: bindReturnOrThrow(node); break; - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: bindTryStatement(node); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: bindSwitchStatement(node); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: bindCaseBlock(node); break; - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: bindCaseClause(node); break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: bindExpressionStatement(node); break; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: bindLabeledStatement(node); break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { // Carry over whether we are in an assignment pattern to // binary expressions that could actually be an initializer @@ -333081,47 +333404,50 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bindCallExpressionFlow(node); break; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: bindJSDocTypeAlias(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 305 /* SyntaxKind.SourceFile */: { + case 308 /* SyntaxKind.SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: bindBindingElementFlow(node); break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 225 /* SyntaxKind.SpreadElement */: + case 166 /* SyntaxKind.Parameter */: + bindParameterFlow(node); + break; + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 227 /* SyntaxKind.SpreadElement */: // Carry over whether we are in an assignment pattern of Object and Array literals // as well as their children that are valid assignment targets. inAssignmentPattern = saveInAssignmentPattern; @@ -333138,19 +333464,19 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: case 108 /* SyntaxKind.ThisKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return containsNarrowableReference(expr); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return hasNarrowableArgument(expr); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isNarrowingExpression(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 53 /* SyntaxKind.ExclamationToken */ && isNarrowingExpression(expr.operand); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; @@ -333174,7 +333500,7 @@ var ts; } } } - if (expr.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expr.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -333207,9 +333533,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (expr.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: return isNarrowableOperand(expr.left); @@ -333285,26 +333611,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: + case 245 /* SyntaxKind.ForStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { + else if (node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { node = node.operand; } else { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */); } @@ -333350,7 +333676,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250 /* SyntaxKind.LabeledStatement */) { + while (label && node.parent.kind === 253 /* SyntaxKind.LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -333401,12 +333727,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.kind === 247 /* SyntaxKind.ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -333428,7 +333754,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (node.kind === 250 /* SyntaxKind.ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -333445,7 +333771,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -333550,7 +333876,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290 /* SyntaxKind.DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293 /* SyntaxKind.DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). Note, we no longer need // this property in control flow analysis, it's there only for backwards compatibility. @@ -333598,7 +333924,7 @@ var ts; function maybeBindExpressionFlowIfCall(node) { // A top level or comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { var call = node; if (call.expression.kind !== 106 /* SyntaxKind.SuperKeyword */ && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -333624,7 +333950,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -333635,10 +333961,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* FlowFlags.Assignment */, currentFlow, node); } - else if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + else if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -333646,16 +333972,16 @@ var ts; } } } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (p.kind === 299 /* SyntaxKind.PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + else if (p.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (p.kind === 301 /* SyntaxKind.SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -333792,7 +334118,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 209 /* SyntaxKind.ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -333820,7 +334146,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -333858,24 +334184,42 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: - // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + // a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759) + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { + if (node.kind !== 342 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { // don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, /*incremental*/ false); @@ -333887,7 +334231,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169 /* SyntaxKind.MethodDeclaration */) { + if (host && host.kind !== 171 /* SyntaxKind.MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* SymbolFlags.Class */); } } @@ -333900,15 +334244,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -333973,7 +334317,7 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 /* SyntaxKind.FunctionExpression */ || expr.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (expr.kind === 215 /* SyntaxKind.FunctionExpression */ || expr.kind === 216 /* SyntaxKind.ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -333985,7 +334329,7 @@ var ts; } } } - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -333994,55 +334338,55 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 286 /* SyntaxKind.JsxAttributes */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 289 /* SyntaxKind.JsxAttributes */: return 1 /* ContainerFlags.IsContainer */; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */; - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: - case 176 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: + case 178 /* SyntaxKind.IndexSignature */: return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */; } // falls through - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 179 /* SyntaxKind.FunctionType */: - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 181 /* SyntaxKind.FunctionType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 16 /* ContainerFlags.IsFunctionExpression */; - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return 4 /* ContainerFlags.IsControlFlowContainer */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer ? 4 /* ContainerFlags.IsControlFlowContainer */ : 0; - case 292 /* SyntaxKind.CatchClause */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 263 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 266 /* SyntaxKind.CaseBlock */: return 2 /* ContainerFlags.IsBlockScopedContainer */; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -334075,46 +334419,46 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 286 /* SyntaxKind.JsxAttributes */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 289 /* SyntaxKind.JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -334222,10 +334566,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -334322,7 +334666,7 @@ var ts; node.originalKeywordKind <= 125 /* SyntaxKind.LastFutureReservedWord */) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + else if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -334424,8 +334768,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 305 /* SyntaxKind.SourceFile */ && - blockScopeContainer.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && + if (blockScopeContainer.kind !== 308 /* SyntaxKind.SourceFile */ && + blockScopeContainer.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -334522,7 +334866,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 160 /* SyntaxKind.LastToken */) { + if (node.kind > 162 /* SyntaxKind.LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -334598,23 +334942,23 @@ var ts; } // falls through case 108 /* SyntaxKind.ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: case 106 /* SyntaxKind.SuperKeyword */: node.flowNode = currentFlow; break; case 80 /* SyntaxKind.PrivateIdentifier */: return checkPrivateIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -334629,7 +334973,7 @@ var ts; declareSymbol(file.locals, /*parent*/ undefined, expr.expression, 1 /* SymbolFlags.FunctionScopedVariable */ | 134217728 /* SymbolFlags.ModuleExports */, 111550 /* SymbolFlags.FunctionScopedVariableExcludes */); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -334665,78 +335009,78 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return checkStrictModeCatchClause(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* SyntaxKind.NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkStrictModeWithStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: seenThisKeyword = true; return; - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: break; // Binding the children will handle everything - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return bindTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return bindParameter(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return bindPropertyWorker(node); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* SymbolFlags.EnumMember */, 900095 /* SymbolFlags.EnumMemberExcludes */); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* SymbolFlags.Signature */, 0 /* SymbolFlags.None */); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* SymbolFlags.Method */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), ts.isObjectLiteralMethod(node) ? 0 /* SymbolFlags.PropertyExcludes */ : 103359 /* SymbolFlags.MethodExcludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return bindFunctionDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* SymbolFlags.Constructor */, /*symbolExcludes:*/ 0 /* SymbolFlags.None */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* SymbolFlags.GetAccessor */, 46015 /* SymbolFlags.GetAccessorExcludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SymbolFlags.SetAccessor */, 78783 /* SymbolFlags.SetAccessorExcludes */); - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: + case 182 /* SyntaxKind.ConstructorType */: return bindFunctionOrConstructorType(node); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 195 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 197 /* SyntaxKind.MappedType */: return bindAnonymousTypeWorker(node); - case 332 /* SyntaxKind.JSDocClassTag */: + case 335 /* SyntaxKind.JSDocClassTag */: return bindJSDocClassTag(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return bindFunctionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* AssignmentDeclarationKind.ObjectDefinePropertyValue */: @@ -334755,70 +335099,73 @@ var ts; } break; // Members of classes, interfaces, and modules - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* SymbolFlags.Interface */, 788872 /* SymbolFlags.InterfaceExcludes */); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return bindEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return bindJsxAttributes(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return bindJsxAttribute(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); // Imports and exports - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return bindImportClause(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return bindExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return bindExportAssignment(node); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 340 /* SyntaxKind.JSDocParameterTag */: - if (node.parent.kind === 323 /* SyntaxKind.JSDocSignature */) { + case 343 /* SyntaxKind.JSDocParameterTag */: + if (node.parent.kind === 326 /* SyntaxKind.JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (node.parent.kind !== 325 /* SyntaxKind.JSDocTypeLiteral */) { break; } // falls through - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ ? 4 /* SymbolFlags.Property */ | 16777216 /* SymbolFlags.Optional */ : 4 /* SymbolFlags.Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* SymbolFlags.PropertyExcludes */); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), 0 /* SymbolFlags.PropertyExcludes */); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 /* SymbolFlags.Accessor */ : 4 /* SymbolFlags.Property */; + var excludes = isAutoAccessor ? 13247 /* SymbolFlags.AccessorExcludes */ : 0 /* SymbolFlags.PropertyExcludes */; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); @@ -334978,8 +335325,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var constructorSymbol = thisContainer.symbol; // For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression. if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -335001,12 +335348,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* SymbolFlags.Class */); } break; - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // this.foo assignment in a JavaScript class // Bind this property to the containing class var containingClass = thisContainer.parent; @@ -335018,7 +335365,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, 0 /* SymbolFlags.None */, /*isReplaceableByMethod*/ true); } break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script if (ts.hasDynamicName(node)) { break; @@ -335047,7 +335394,7 @@ var ts; if (node.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -335087,7 +335434,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + var isToplevel = node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false, /*containerIsClass*/ false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false); } @@ -335196,8 +335543,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 /* SyntaxKind.SourceFile */ - : propertyAccess.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 /* SyntaxKind.SourceFile */ + : propertyAccess.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -335276,7 +335623,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257 /* SyntaxKind.ClassDeclaration */) { + if (node.kind === 260 /* SyntaxKind.ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* SymbolFlags.Class */, 899503 /* SymbolFlags.ClassExcludes */); } else { @@ -335318,7 +335665,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -335346,7 +335693,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 323 /* SyntaxKind.JSDocSignature */) { + if (node.kind === 343 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 326 /* SyntaxKind.JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { @@ -335423,7 +335770,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144 /* SymbolFlags.TypeParameter */, 526824 /* SymbolFlags.TypeParameterExcludes */); } } - else if (node.parent.kind === 190 /* SyntaxKind.InferType */) { + else if (node.parent.kind === 192 /* SyntaxKind.InferType */) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -335451,11 +335798,11 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 236 /* SyntaxKind.EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 239 /* SyntaxKind.EmptyStatement */) || // report error on class declarations - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); + (node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -335499,12 +335846,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* ModuleInstanceState.Instantiated */; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.hasSyntacticModifier(s, 2048 /* ModifierFlags.Const */); default: return false; @@ -335705,7 +336052,7 @@ var ts; // (their type resolved directly to the member deeply referenced) // So to get the intervening symbols, we need to check if there's a type // query node on any of the symbol's declarations and get symbols there - if (d.type && d.type.kind === 181 /* SyntaxKind.TypeQuery */) { + if (d.type && d.type.kind === 183 /* SyntaxKind.TypeQuery */) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -335891,8 +336238,6 @@ var ts; IntersectionState[IntersectionState["None"] = 0] = "None"; IntersectionState[IntersectionState["Source"] = 1] = "Source"; IntersectionState[IntersectionState["Target"] = 2] = "Target"; - IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck"; - IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck"; })(IntersectionState || (IntersectionState = {})); var RecursionFlags; (function (RecursionFlags) { @@ -336116,6 +336461,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -336141,6 +336487,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -336309,6 +336656,12 @@ var ts; getOptionalType: function () { return optionalType; }, getPromiseType: function () { return getGlobalPromiseType(/*reportErrors*/ false); }, getPromiseLikeType: function () { return getGlobalPromiseLikeType(/*reportErrors*/ false); }, + getAsyncIterableType: function () { + var type = getGlobalAsyncIterableType(/*reportErrors*/ false); + if (type === emptyGenericType) + return undefined; + return type; + }, isSymbolAccessible: isSymbolAccessible, isArrayType: isArrayType, isTupleType: isTupleType, @@ -336389,6 +336742,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -336508,7 +336862,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -336622,6 +336977,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name var flowLoopStart = 0; var flowLoopCount = 0; @@ -336811,10 +337168,10 @@ var ts; } // Issue errors globally var file = ts.getSourceFileOfNode(location); - addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line local/no-in-operator return; } - addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line local/no-in-operator } function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { var diagnostic = error(location, message, arg0, arg1, arg2, arg3); @@ -337043,7 +337400,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -337131,7 +337488,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -337142,9 +337499,9 @@ var ts; return symbol; } if (symbol.flags & 2097152 /* SymbolFlags.Alias */) { - var target = resolveAlias(symbol); - // Unknown symbol means an error occurred in alias resolution, treat it as positive answer to avoid cascading errors - if (target === unknownSymbol || target.flags & meaning) { + var targetFlags = getAllSymbolFlags(symbol); + // `targetFlags` will be `SymbolFlags.All` if an error occurred in alias resolution; this avoids cascading errors + if (targetFlags & meaning) { return symbol; } } @@ -337190,17 +337547,17 @@ var ts; } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { // declaration is before usage - if (declaration.kind === 203 /* SyntaxKind.BindingElement */) { + if (declaration.kind === 205 /* SyntaxKind.BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 203 /* SyntaxKind.BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 205 /* SyntaxKind.BindingElement */); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254 /* SyntaxKind.VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257 /* SyntaxKind.VariableDeclaration */), usage); } - else if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { + else if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -337230,12 +337587,12 @@ var ts; // or if usage is in a type context: // 1. inside a type query (typeof in type position) // 2. inside a jsdoc comment - if (usage.parent.kind === 275 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { // export specifiers do not use the variable, they only make it available for use return true; } // When resolving symbols for exports, the `usage` location passed in can be the export site directly - if (usage.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608 /* NodeFlags.JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -337257,9 +337614,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237 /* SyntaxKind.VariableStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 240 /* SyntaxKind.VariableStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, declContainer)) { @@ -337287,7 +337644,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (declaration.kind === 171 /* SyntaxKind.MethodDeclaration */) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -337302,7 +337659,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -337325,19 +337682,19 @@ var ts; return "quit"; } switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // even when stopping at any property declaration, they need to come from the same class return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; @@ -337377,18 +337734,18 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: // do not descend into these return false; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // static properties in classes introduce temporary variables if (ts.hasStaticModifier(node)) { return target < 99 /* ScriptTarget.ESNext */ || !useDefineForClassFields; @@ -337417,12 +337774,13 @@ var ts; * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with * the given name can be found. * + * @param nameNotFoundMessage If defined, we will report errors found during resolve. * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -337453,14 +337811,14 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 320 /* SyntaxKind.JSDoc */) { + if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 323 /* SyntaxKind.JSDoc */) { useResult = result.flags & 262144 /* SymbolFlags.TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || - lastLocation.kind === 340 /* SyntaxKind.JSDocParameterTag */ || - lastLocation.kind === 341 /* SyntaxKind.JSDocReturnTag */ || - lastLocation.kind === 163 /* SyntaxKind.TypeParameter */ + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || + lastLocation.kind === 343 /* SyntaxKind.JSDocParameterTag */ || + lastLocation.kind === 344 /* SyntaxKind.JSDocReturnTag */ || + lastLocation.kind === 165 /* SyntaxKind.TypeParameter */ // local types not visible outside the function body : false; } @@ -337475,13 +337833,13 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (location.kind === 191 /* SyntaxKind.ConditionalType */) { // A type parameter declared using 'infer T' in a conditional type is visible only in // the true branch of the conditional type. useResult = lastLocation === location.trueType; @@ -337496,14 +337854,14 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default" /* InternalSymbolName.Default */)) { @@ -337527,7 +337885,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* SymbolFlags.Alias */ && - (ts.getDeclarationOfKind(moduleExport, 275 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 274 /* SyntaxKind.NamespaceExport */))) { + (ts.getDeclarationOfKind(moduleExport, 278 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 277 /* SyntaxKind.NamespaceExport */))) { break; } } @@ -337541,12 +337899,12 @@ var ts; } } break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* SymbolFlags.EnumMember */)) { break loop; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -337564,9 +337922,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals // These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would // trigger resolving late-bound names, which we may already be in the process of doing while we're here! @@ -337580,12 +337938,14 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { + if (location.kind === 228 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -337593,7 +337953,7 @@ var ts; } } break; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 94 /* SyntaxKind.ExtendsKeyword */) { var container = location.parent.parent; @@ -337613,34 +337973,36 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error if (ts.getEmitScriptTarget(compilerOptions) >= 2 /* ScriptTarget.ES2015 */) { break; } // falls through - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -337653,7 +338015,7 @@ var ts; } } break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -337662,7 +338024,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 164 /* SyntaxKind.Parameter */) { + if (location.parent && location.parent.kind === 166 /* SyntaxKind.Parameter */) { location = location.parent; } // @@ -337677,20 +338039,20 @@ var ts; // declare function y(x: T): any; // @param(1 as T) // <-- T should resolve to the type alias outside of class C // class C {} - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257 /* SyntaxKind.ClassDeclaration */)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260 /* SyntaxKind.ClassDeclaration */)) { location = location.parent; } break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // js type aliases do not resolve names from their host, so skip past it var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -337698,7 +338060,7 @@ var ts; } } break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -337706,7 +338068,7 @@ var ts; } } break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: if (meaning & 262144 /* SymbolFlags.TypeParameter */) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -337732,7 +338094,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(lastLocation.kind === 308 /* SyntaxKind.SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -337772,8 +338134,8 @@ var ts; !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && + !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && - !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) { var suggestion = void 0; var suggestedLib = void 0; @@ -337814,7 +338176,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } // Perform extra checks only if error reporting was requested @@ -337860,9 +338222,9 @@ var ts; } } if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { - var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); + var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* SymbolFlags.Value */); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ + var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -337876,31 +338238,31 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 /* SyntaxKind.ArrowFunction */ && location.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (location.kind !== 216 /* SyntaxKind.ArrowFunction */ && location.kind !== 215 /* SyntaxKind.FunctionExpression */) { // initializers in instance property declaration of class like entities are executed in constructor and thus deferred return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + (location.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === location.name) { return false; } // generator functions and async functions are not inlined in control flow when immediately invoked - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256 /* ModifierFlags.Async */)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512 /* ModifierFlags.Async */)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -337913,7 +338275,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163 /* SyntaxKind.TypeParameter */) { + if (decl.kind === 165 /* SyntaxKind.TypeParameter */) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -337970,9 +338332,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -338016,14 +338378,14 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } return false; } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { - if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */)) { + if (meaning & 111551 /* SymbolFlags.Value */) { if (isPrimitiveTypeName(name)) { if (isExtendedByInterface(errorLocation)) { error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name)); @@ -338034,7 +338396,8 @@ var ts; return true; } var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); - if (symbol && !(symbol.flags & 1024 /* SymbolFlags.NamespaceModule */)) { + var allFlags = symbol && getAllSymbolFlags(symbol); + if (symbol && allFlags !== undefined && !(allFlags & 111551 /* SymbolFlags.Value */)) { var rawName = ts.unescapeLeadingUnderscores(name); if (isES2015OrLaterConstructorName(name)) { error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName); @@ -338082,16 +338445,16 @@ var ts; } return false; } - function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { - if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~788968 /* SymbolFlags.Type */)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); + function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) { + if (meaning & (111551 /* SymbolFlags.Value */ & ~788968 /* SymbolFlags.Type */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name)); return true; } } - else if (meaning & (788968 /* SymbolFlags.Type */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* SymbolFlags.ValueModule */ | 1024 /* SymbolFlags.NamespaceModule */) & ~788968 /* SymbolFlags.Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); + else if (meaning & (788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1536 /* SymbolFlags.Module */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name)); return true; @@ -338107,7 +338470,7 @@ var ts; return; } // Block-scoped variables cannot be used before their definition - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260 /* SyntaxKind.EnumDeclaration */); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263 /* SyntaxKind.EnumDeclaration */); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -338144,13 +338507,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.parent; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -338175,24 +338538,24 @@ var ts; * const { x } = require ... */ function isAliasSymbolDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name - || node.kind === 268 /* SyntaxKind.NamespaceImport */ - || node.kind === 274 /* SyntaxKind.NamespaceExport */ - || node.kind === 270 /* SyntaxKind.ImportSpecifier */ - || node.kind === 275 /* SyntaxKind.ExportSpecifier */ - || node.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name + || node.kind === 271 /* SyntaxKind.NamespaceImport */ + || node.kind === 277 /* SyntaxKind.NamespaceExport */ + || node.kind === 273 /* SyntaxKind.ImportSpecifier */ + || node.kind === 278 /* SyntaxKind.ExportSpecifier */ + || node.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || node.kind === 296 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || node.kind === 299 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -338205,7 +338568,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, /*overwriteEmpty*/ false); @@ -338218,7 +338581,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */; + var isExport = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -338237,7 +338600,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -338337,11 +338700,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; + case 270 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -338610,31 +338973,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 270 /* SyntaxKind.ImportSpecifier */: - case 203 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, dontRecursivelyResolve); - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return resolveEntityName(node.name, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ true, dontRecursivelyResolve); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -338681,6 +339044,52 @@ var ts; } return undefined; } + /** + * Gets combined flags of a `symbol` and all alias targets it resolves to. `resolveAlias` + * is typically recursive over chains of aliases, but stops mid-chain if an alias is merged + * with another exported symbol, e.g. + * ```ts + * // a.ts + * export const a = 0; + * // b.ts + * export { a } from "./a"; + * export type a = number; + * // c.ts + * import { a } from "./b"; + * ``` + * Calling `resolveAlias` on the `a` in c.ts would stop at the merged symbol exported + * from b.ts, even though there is still more alias to resolve. Consequently, if we were + * trying to determine if the `a` in c.ts has a value meaning, looking at the flags on + * the local symbol and on the symbol returned by `resolveAlias` is not enough. + * @returns SymbolFlags.All if `symbol` is an alias that ultimately resolves to `unknown`; + * combined flags of all alias targets otherwise. + */ + function getAllSymbolFlags(symbol) { + var flags = symbol.flags; + var seenSymbols; + while (symbol.flags & 2097152 /* SymbolFlags.Alias */) { + var target = resolveAlias(symbol); + if (target === unknownSymbol) { + return 67108863 /* SymbolFlags.All */; + } + // Optimizations - try to avoid creating or adding to + // `seenSymbols` if possible + if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) { + break; + } + if (target.flags & 2097152 /* SymbolFlags.Alias */) { + if (seenSymbols) { + seenSymbols.add(target); + } + else { + seenSymbols = new ts.Set([symbol, target]); + } + } + flags |= target.flags; + symbol = target; + } + return flags; + } /** * Marks a symbol as type-only if its declaration is syntactically type-only. * If it is not itself marked type-only, but resolves to a type-only alias @@ -338726,19 +339135,25 @@ var ts; return !!aliasDeclarationLinks.typeOnlyDeclaration; } /** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */ - function getTypeOnlyAliasDeclaration(symbol) { + function getTypeOnlyAliasDeclaration(symbol, include) { if (!(symbol.flags & 2097152 /* SymbolFlags.Alias */)) { return undefined; } var links = getSymbolLinks(symbol); - return links.typeOnlyDeclaration || undefined; + if (include === undefined) { + return links.typeOnlyDeclaration || undefined; + } + if (links.typeOnlyDeclaration) { + return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined; + } + return undefined; } function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target) { var markAlias = target === unknownSymbol || - ((target.flags & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol)); + ((getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)); if (markAlias) { markAliasSymbolAsReferenced(symbol); } @@ -338758,8 +339173,7 @@ var ts; // This way a chain of imports can be elided if ultimately the final input is only used in a type // position. if (ts.isInternalModuleImportEqualsDeclaration(node)) { - var target = resolveSymbol(symbol); - if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* SymbolFlags.Value */) { // import foo = checkExpressionCached(node.moduleReference); } @@ -338786,18 +339200,18 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 163 /* SyntaxKind.QualifiedName */) { return resolveEntityName(entityName, 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */); return resolveEntityName(entityName, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -338838,9 +339252,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 /* SyntaxKind.QualifiedName */ || name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - var left = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; - var right = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : name.name; + else if (name.kind === 163 /* SyntaxKind.QualifiedName */ || name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + var left = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; + var right = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -338898,7 +339312,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1 /* CheckFlags.Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 271 /* SyntaxKind.ExportAssignment */)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 274 /* SyntaxKind.ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -339221,7 +339635,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -339581,13 +339995,13 @@ var ts; } function symbolIsValue(symbol, includeTypeOnlyMembers) { return !!(symbol.flags & 111551 /* SymbolFlags.Value */ || - symbol.flags & 2097152 /* SymbolFlags.Alias */ && resolveAlias(symbol).flags & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); + symbol.flags & 2097152 /* SymbolFlags.Alias */ && getAllSymbolFlags(symbol) & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); } function findConstructorDeclaration(node) { var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -339695,12 +340109,12 @@ var ts; } } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var sym = getSymbolOfNode(location); // `sym` may not have exports if this module declaration is backed by the symbol for a `const` that's being rewritten // into a namespace - in such cases, it's best to just let the namespace appear empty (the const members couldn't have referred @@ -339709,9 +340123,9 @@ var ts; return { value: result }; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // Type parameters are bound into `members` lists so they can merge across declarations // This is troublesome, since in all other respects, they behave like locals :cries: // TODO: the below is shared with similar code in `resolveName` - in fact, rephrasing all this symbol @@ -339806,7 +340220,7 @@ var ts; && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ // See similar comment in `resolveName` for details - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -339850,8 +340264,10 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; - if (symbolFromSymbolTable.flags & meaning) { + var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)); + symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags; + if (flags & meaning) { qualify = true; return true; } @@ -339865,10 +340281,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: continue; default: return false; @@ -339998,10 +340414,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -340069,14 +340485,14 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 181 /* SyntaxKind.TypeQuery */ || - entityName.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (entityName.parent.kind === 183 /* SyntaxKind.TypeQuery */ || + entityName.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Typeof value meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } - else if (entityName.kind === 161 /* SyntaxKind.QualifiedName */ || entityName.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (entityName.kind === 163 /* SyntaxKind.QualifiedName */ || entityName.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* SymbolFlags.Namespace */; @@ -340112,15 +340528,18 @@ var ts; if (flags & 8 /* SymbolFormatFlags.UseAliasDefinedOutsideCurrentScope */) { nodeFlags |= 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */; } - if (flags & 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { + if (flags & 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { nodeFlags |= 134217728 /* NodeBuilderFlags.DoNotIncludeSymbolChain */; } - var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16 /* SymbolFormatFlags.WriteComputedProps */) { + nodeFlags |= 1073741824 /* NodeBuilderFlags.WriteComputedProps */; + } + var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); // TODO: GH#18217 // add neverAsciiEscape for GH#39027 - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4 /* EmitHint.Unspecified */, entity, /*sourceFile*/ sourceFile, writer); return writer; @@ -340132,10 +340551,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144 /* TypeFormatFlags.WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 180 /* SyntaxKind.ConstructorType */ : 179 /* SyntaxKind.FunctionType */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 182 /* SyntaxKind.ConstructorType */ : 181 /* SyntaxKind.FunctionType */; } else { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 175 /* SyntaxKind.ConstructSignature */ : 174 /* SyntaxKind.CallSignature */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 177 /* SyntaxKind.ConstructSignature */ : 176 /* SyntaxKind.CallSignature */; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -340215,7 +340634,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824 /* NodeBuilderFlags.WriteComputedProps */) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 /* TypeFlags.EnumLiteral */ | 8192 /* TypeFlags.UniqueESSymbol */)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8 /* NodeFlags.Synthesized */) === 0); @@ -340300,7 +340737,7 @@ var ts; return undefined; // TODO: GH#18217 } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (!(context.flags & 536870912 /* NodeBuilderFlags.NoTypeReduction */)) { type = getReducedType(type); @@ -340310,29 +340747,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 /* SyntaxKind.IntrinsicKeyword */ : 130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 /* SyntaxKind.IntrinsicKeyword */ : 131 /* SyntaxKind.AnyKeyword */); } if (type.flags & 2 /* TypeFlags.Unknown */) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (type.flags & 4 /* TypeFlags.String */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + return ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); } if (type.flags & 8 /* TypeFlags.Number */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147 /* SyntaxKind.NumberKeyword */); + return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.NumberKeyword */); } if (type.flags & 64 /* TypeFlags.BigInt */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158 /* SyntaxKind.BigIntKeyword */); + return ts.factory.createKeywordTypeNode(160 /* SyntaxKind.BigIntKeyword */); } if (type.flags & 16 /* TypeFlags.Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133 /* SyntaxKind.BooleanKeyword */); + return ts.factory.createKeywordTypeNode(134 /* SyntaxKind.BooleanKeyword */); } if (type.flags & 1024 /* TypeFlags.EnumLiteral */ && !(type.flags & 1048576 /* TypeFlags.Union */)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -340386,7 +340823,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */)); + return ts.factory.createTypeOperatorNode(156 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */)); } if (type.flags & 16384 /* TypeFlags.Void */) { context.approximateLength += 4; @@ -340394,7 +340831,7 @@ var ts; } if (type.flags & 32768 /* TypeFlags.Undefined */) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); } if (type.flags & 65536 /* TypeFlags.Null */) { context.approximateLength += 4; @@ -340402,15 +340839,15 @@ var ts; } if (type.flags & 131072 /* TypeFlags.Never */) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */); + return ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */); } if (type.flags & 4096 /* TypeFlags.ESSymbol */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */); + return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */); } if (type.flags & 67108864 /* TypeFlags.NonPrimitive */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.ObjectKeyword */); + return ts.factory.createKeywordTypeNode(149 /* SyntaxKind.ObjectKeyword */); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304 /* NodeBuilderFlags.InObjectTypeLiteral */) { @@ -340499,7 +340936,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); + return ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); } if (type.flags & 134217728 /* TypeFlags.TemplateLiteral */) { var texts_1 = type.texts; @@ -340551,7 +340988,7 @@ var ts; // On the other hand, // checkType extends infer T extends checkType ? T extends extendsType ? trueType : falseType : never; // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS. - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -340593,7 +341030,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -340609,7 +341046,7 @@ var ts; // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting // type stays homomorphic var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } return result; } @@ -340657,7 +341094,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* SymbolFlags.Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 262 /* SyntaxKind.ModuleBlock */; + return declaration.parent.kind === 308 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 265 /* SyntaxKind.ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -340746,12 +341183,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179 /* SyntaxKind.FunctionType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181 /* SyntaxKind.FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180 /* SyntaxKind.ConstructorType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182 /* SyntaxKind.ConstructorType */, context); return signatureNode; } } @@ -340794,7 +341231,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, arrayType); } else if (type.target.objectFlags & 8 /* ObjectFlags.Tuple */) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2 /* ElementFlags.Optional */)); }); @@ -340819,12 +341256,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288 /* NodeBuilderFlags.AllowEmptyTuple */)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; // TODO: GH#18217 @@ -340931,13 +341368,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174 /* SyntaxKind.CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176 /* SyntaxKind.CallSignature */, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4 /* SignatureFlags.Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175 /* SyntaxKind.ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177 /* SyntaxKind.ConstructSignature */, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -340974,7 +341411,7 @@ var ts; if (!(context.flags & 1 /* NodeBuilderFlags.NoTruncation */)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), /*typeArguments*/ undefined); } - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -341024,7 +341461,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768 /* TypeFlags.Undefined */); }), 0 /* SignatureKind.Call */); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -341038,12 +341475,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -341052,8 +341489,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3 /* SyntaxKind.MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -341152,7 +341589,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -341170,7 +341607,7 @@ var ts; } var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0]; // If the expanded parameter list had a variadic in a non-trailing position, don't expand it - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 /* NodeBuilderFlags.OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -341179,7 +341616,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? - ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : + ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined; var parameterName = typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216 /* EmitFlags.NoAsciiEscaping */) : @@ -341193,28 +341630,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + returnTypeNode = ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { + if ((kind === 182 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128 /* ModifierFlags.Abstract */); - } - var node = kind === 174 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 171 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : - kind === 172 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : - kind === 173 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : - kind === 176 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 213 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256 /* ModifierFlags.Abstract */); + } + var node = kind === 176 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 173 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : + kind === 174 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : + kind === 175 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : + kind === 178 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 215 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -341251,9 +341688,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164 /* SyntaxKind.Parameter */); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166 /* SyntaxKind.Parameter */); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340 /* SyntaxKind.JSDocParameterTag */); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343 /* SyntaxKind.JSDocParameterTag */); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -341265,7 +341702,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216 /* EmitFlags.NoAsciiEscaping */) : - parameterDeclaration.name.kind === 161 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : + parameterDeclaration.name.kind === 163 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -341429,11 +341866,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */); + var file = ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305 /* SyntaxKind.SourceFile */); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308 /* SyntaxKind.SourceFile */); } } if (file && file.moduleName !== undefined) { @@ -341901,17 +342338,17 @@ var ts; return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { // We don't _actually_ support jsdoc namepath types, emit `any` instead - if (ts.isJSDocAllType(node) || node.kind === 319 /* SyntaxKind.JSDocNamepathType */) { - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + if (ts.isJSDocAllType(node) || node.kind === 322 /* SyntaxKind.JSDocNamepathType */) { + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -341925,11 +342362,11 @@ var ts; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; return ts.factory.createPropertySignature( - /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature( @@ -341944,12 +342381,12 @@ var ts; return ts.factory.createConstructorTypeNode( /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } else { return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */, /*ignoreErrors*/ true))) { @@ -342017,8 +342454,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); // TODO: Use `setOriginalNode` on original declaration names where possible so these declarations see some kind of // declaration mapping // We save the enclosing declaration off here so it's not adjusted by well-meaning declaration @@ -342142,7 +342579,7 @@ var ts; // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it var indices = ts.indicesOf(statements); var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); }); - if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) { + if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) { for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) { var index_1 = associatedIndices_1[_i]; statements[index_1] = addExportModifier(statements[index_1]); @@ -342176,15 +342613,6 @@ var ts; } return statements; } - function canHaveExportModifier(node) { - return ts.isEnumDeclaration(node) || - ts.isVariableStatement(node) || - ts.isFunctionDeclaration(node) || - ts.isClassDeclaration(node) || - (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) || - ts.isInterfaceDeclaration(node) || - isTypeDeclaration(node); - } function addExportModifier(node) { var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */; return ts.factory.updateModifiers(node, flags); @@ -342256,7 +342684,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* ModifierFlags.Default */ : 0); + var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* ModifierFlags.Default */ : 0); var isConstMergedWithNS = symbol.flags & 1536 /* SymbolFlags.Module */ && symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 1 /* SymbolFlags.FunctionScopedVariable */ | 4 /* SymbolFlags.Property */) && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */; @@ -342273,6 +342701,7 @@ var ts; && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */ && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */) && !(symbol.flags & 32 /* SymbolFlags.Class */) + && !(symbol.flags & 8192 /* SymbolFlags.Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -342430,7 +342859,7 @@ var ts; (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration); if (additionalModifierFlags & 1 /* ModifierFlags.Export */ && enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) && - canHaveExportModifier(node)) { + ts.canHaveExportModifier(node)) { // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private newModifierFlags |= 1 /* ModifierFlags.Export */; } @@ -342440,8 +342869,8 @@ var ts; // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope newModifierFlags |= 2 /* ModifierFlags.Ambient */; } - if ((additionalModifierFlags & 512 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512 /* ModifierFlags.Default */; + if ((additionalModifierFlags & 1024 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024 /* ModifierFlags.Default */; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -342475,8 +342904,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 174 /* SyntaxKind.CallSignature */); - var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 175 /* SyntaxKind.ConstructSignature */); + var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 176 /* SyntaxKind.CallSignature */); + var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 177 /* SyntaxKind.ConstructSignature */); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94 /* SyntaxKind.ExtendsKeyword */, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551 /* SymbolFlags.Value */); }))]; addResult(ts.factory.createInterfaceDeclaration( @@ -342486,7 +342915,7 @@ var ts; return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember); } function isTypeOnlyNamespace(symbol) { - return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* SymbolFlags.Value */); }); + return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* SymbolFlags.Value */); }); } function serializeModule(symbol, symbolName, modifierFlags) { var members = getNamespaceMembersForSerialization(symbol); @@ -342541,7 +342970,7 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; // Each overload becomes a separate function declaration, in order - var decl = signatureToSignatureDeclarationHelper(sig, 256 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } // Module symbol emit will take care of module-y members, provided it has exports @@ -342699,7 +343128,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1 /* SignatureKind.Construct */)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8 /* ModifierFlags.Private */), [], /*body*/ undefined)] : - serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 171 /* SyntaxKind.Constructor */); + serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 173 /* SyntaxKind.Constructor */); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration( @@ -342748,8 +343177,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); // the target may be within the same scope - attempt to serialize it first switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254 /* SyntaxKind.VariableDeclaration */) { + case 205 /* SyntaxKind.BindingElement */: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257 /* SyntaxKind.VariableDeclaration */) { // const { SomeClass } = require('./lib'); var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' var propertyName = node.propertyName; @@ -342762,13 +343191,13 @@ var ts; // We don't know how to serialize this (nested?) binding element ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221 /* SyntaxKind.BinaryExpression */) { + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223 /* SyntaxKind.BinaryExpression */) { // module.exports = { SomeClass } serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // commonjs require: const x = require('y') if (ts.isPropertyAccessExpression(node.initializer)) { // const x = require('y').z @@ -342786,7 +343215,7 @@ var ts; break; } // else fall through and treat commonjs require just like import= - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // This _specifically_ only exists to handle json declarations - where we make aliases, but since // we emit no declarations for the json document, must not refer to it in the declarations if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, ts.isJsonSourceFile)) { @@ -342802,13 +343231,13 @@ var ts; ? symbolToName(target, context, 67108863 /* SymbolFlags.All */, /*expectsIdentifier*/ false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0 /* ModifierFlags.None */); break; - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // export as namespace foo // TODO: Not part of a file's local or export symbol tables // Is bound into file.symbol.globalExports instead, which we don't currently traverse addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0 /* ModifierFlags.None */); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, ts.factory.createIdentifier(localName), /*namedBindings*/ undefined), // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned @@ -342817,17 +343246,17 @@ var ts; ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*importClause*/ undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: addResult(ts.factory.createExportDeclaration( /*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0 /* ModifierFlags.None */); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause( /*isTypeOnly*/ false, @@ -342837,7 +343266,7 @@ var ts; ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: // does not use localName because the symbol name in this case refers to the name in the exports table, // which we must exactly preserve var specifier = node.parent.parent.moduleSpecifier; @@ -342845,12 +343274,12 @@ var ts; // another file serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 221 /* SyntaxKind.BinaryExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // Could be best encoded as though an export specifier or as though an export assignment // If name is default or export=, do an export assignment // Otherwise do an export specifier @@ -342994,7 +343423,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); + var flag = (modifierFlags & ~512 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 /* SymbolFlags.Accessor */ && useAccessors) { @@ -343016,7 +343445,7 @@ var ts; // This is an else/if as accessors and properties can't merge in TS, but might in JS // If this happens, we assume the accessor takes priority, as it imposes more constraints else if (p.flags & (4 /* SymbolFlags.Property */ | 3 /* SymbolFlags.Variable */ | 98304 /* SymbolFlags.Accessor */)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); @@ -343206,7 +343635,7 @@ var ts; if (flags === void 0) { flags = 16384 /* TypeFormatFlags.UseAliasDefinedOutsideCurrentScope */; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 ); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); @@ -343253,7 +343682,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -343261,11 +343690,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); + return location.kind === 308 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -343324,17 +343753,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; // Declaration may be nameless, but we'll try anyway } - if (declaration.parent && declaration.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 226 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -343351,28 +343780,28 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return isDeclarationVisible(node.parent.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -343380,55 +343809,55 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) && - !(node.kind !== 265 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 305 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { + !(node.kind !== 268 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 308 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 164 /* SyntaxKind.Parameter */: - case 262 /* SyntaxKind.ModuleBlock */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 178 /* SyntaxKind.TypeReference */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 166 /* SyntaxKind.Parameter */: + case 265 /* SyntaxKind.ModuleBlock */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 180 /* SyntaxKind.TypeReference */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: return false; // Type parameters are always visible - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: // Source file and namespace export are always visible // falls through - case 305 /* SyntaxKind.SourceFile */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return false; default: return false; @@ -343437,10 +343866,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.parent && node.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + else if (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */); } var result; @@ -343547,12 +343976,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 255 /* SyntaxKind.VariableDeclarationList */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 269 /* SyntaxKind.NamedImports */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 258 /* SyntaxKind.VariableDeclarationList */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 272 /* SyntaxKind.NamedImports */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: return false; default: return true; @@ -343682,23 +344111,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ancestor.initializer; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 /* SyntaxKind.BindingElement */ && parent.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (node.kind === 205 /* SyntaxKind.BindingElement */ && parent.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 /* SyntaxKind.PropertyAssignment */ || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.kind === 299 /* SyntaxKind.PropertyAssignment */ || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -343728,7 +344157,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288 /* TypeFacts.NEUndefined */); } var type; - if (pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* TypeFlags.Unknown */ || !isValidSpreadType(parentType)) { @@ -343799,7 +344228,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -343810,11 +344239,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode))); return indexType.flags & (262144 /* TypeFlags.TypeParameter */ | 4194304 /* TypeFlags.Index */) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -343825,7 +344254,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -343852,8 +344281,8 @@ var ts; if (ts.isParameter(declaration)) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 173 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172 /* SyntaxKind.GetAccessor */); + if (func.kind === 175 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174 /* SyntaxKind.GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -343865,11 +344294,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; // Use contextual parameter type if one is available var type = declaration.symbol.escapedName === "this" /* InternalSymbolName.This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { @@ -343930,7 +344357,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration); }); } @@ -343952,11 +344379,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, /*includeArrowFunctions*/ false); - if (container && (container.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { return container; } } - ; } /** Create a synthetic property access flow node after the last statement of the file */ function getFlowTypeFromCommonJSExport(symbol) { @@ -344249,9 +344675,9 @@ var ts; var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. - return thisContainer.kind === 171 /* SyntaxKind.Constructor */ || - thisContainer.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (thisContainer.kind === 213 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 /* SyntaxKind.Constructor */ || + thisContainer.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (thisContainer.kind === 215 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -344321,7 +344747,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ScriptTarget.ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -344346,7 +344772,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + return pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -344394,7 +344820,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 /* SyntaxKind.Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 166 /* SyntaxKind.Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -344449,9 +344875,9 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); + var type_1 = getTypeOfNode(typeNode); // an errorType will make `checkTryStatement` issue an error - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } // Handle export default expressions if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { @@ -344474,7 +344900,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (declaration.kind === 274 /* SyntaxKind.ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -344542,13 +344968,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174 /* SyntaxKind.GetAccessor */: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175 /* SyntaxKind.SetAccessor */: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169 /* SyntaxKind.PropertyDeclaration */: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -344570,14 +345000,17 @@ var ts; if (!pushTypeResolution(symbol, 0 /* TypeSystemPropertyName.Type */)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); // We try to resolve a getter type annotation, a setter type annotation, or a getter function // body return type inference, in that order. var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -344585,6 +345018,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -344594,6 +345030,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -344604,12 +345043,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8 /* TypeSystemPropertyName.WriteType */)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -344649,9 +345089,9 @@ var ts; if (symbol.flags & 1536 /* SymbolFlags.Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || + else if (declaration && (declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221 /* SyntaxKind.BinaryExpression */)) { + declaration.parent.kind === 223 /* SyntaxKind.BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* SymbolFlags.ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -344661,11 +345101,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* InternalSymbolName.ExportEquals */)); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16 /* ObjectFlags.Anonymous */, symbol); @@ -344695,7 +345135,7 @@ var ts; links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType - : targetSymbol.flags & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol) + : getAllSymbolFlags(targetSymbol) & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol) : errorType; } return links.type; @@ -344716,7 +345156,7 @@ var ts; return errorType; } // Check if variable has initializer that circularly references the variable itself - if (noImplicitAny && (declaration.kind !== 164 /* SyntaxKind.Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 /* SyntaxKind.Parameter */ || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } // Circularities could also result from parameters in function expressions that end up @@ -344848,46 +345288,46 @@ var ts; return undefined; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 195 /* SyntaxKind.MappedType */: - case 189 /* SyntaxKind.ConditionalType */: { + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 197 /* SyntaxKind.MappedType */: + case 191 /* SyntaxKind.ConditionalType */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195 /* SyntaxKind.MappedType */) { + if (node.kind === 197 /* SyntaxKind.MappedType */) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (node.kind === 191 /* SyntaxKind.ConditionalType */) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && + (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320 /* SyntaxKind.JSDoc */: { + case 323 /* SyntaxKind.JSDoc */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -344898,7 +345338,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -344911,9 +345351,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || - node.kind === 226 /* SyntaxKind.ClassExpression */ || + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || + node.kind === 228 /* SyntaxKind.ClassExpression */ || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -345065,7 +345505,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -345161,7 +345601,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -345201,7 +345641,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (declaration.flags & 128 /* NodeFlags.ContainsThis */) { return false; } @@ -345280,7 +345720,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339 /* SyntaxKind.JSDocEnumTag */) { + if (declaration.kind === 342 /* SyntaxKind.JSDocEnumTag */) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -345295,7 +345735,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221 /* SyntaxKind.BinaryExpression */) { + else if (expr.kind === 223 /* SyntaxKind.BinaryExpression */) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -345310,12 +345750,12 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; case 79 /* SyntaxKind.Identifier */: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isStringConcatExpression(expr); default: return false; @@ -345330,7 +345770,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -345359,7 +345799,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -345432,22 +345872,22 @@ var ts; */ function isThislessType(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 196 /* SyntaxKind.LiteralType */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 198 /* SyntaxKind.LiteralType */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isThislessType(node.elementType); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -345473,7 +345913,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -345489,14 +345929,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -345707,8 +346147,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -345723,8 +346165,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */ || assignmentKind === 6 /* AssignmentDeclarationKind.Prototype */; // A straight `Prototype` assignment probably can never have a computed name - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -345911,7 +346355,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, isAbstract ? 4 /* SignatureFlags.Abstract */ : 0 /* SignatureFlags.None */)]; } @@ -346533,8 +346977,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217 - return constraintDeclaration.kind === 193 /* SyntaxKind.TypeOperator */ && - constraintDeclaration.operator === 140 /* SyntaxKind.KeyOfKeyword */; + return constraintDeclaration.kind === 195 /* SyntaxKind.TypeOperator */ && + constraintDeclaration.operator === 141 /* SyntaxKind.KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -346574,7 +347018,20 @@ var ts; return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */); } function isGenericMappedType(type) { - return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type)); + if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) { + var constraint = getConstraintTypeFromMappedType(type); + if (isGenericIndexType(constraint)) { + return true; + } + // A mapped type is generic if the 'as' clause references generic types other than the iteration type. + // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration + // type and check whether the resulting type is generic. + var nameType = getNameTypeFromMappedType(type); + if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) { + return true; + } + } + return false; } function resolveStructuredTypeMembers(type) { if (!type.members) { @@ -346894,10 +347351,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -346941,7 +347398,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432 /* TypeFlags.Substitution */) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -347044,7 +347501,7 @@ var ts; var indexTypes; var isUnion = containingType.flags & 1048576 /* TypeFlags.Union */; // Flags we want to propagate to the result if they exist in all source symbols - var optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */; + var optionalFlag; var syntheticFlag = 4 /* CheckFlags.SyntheticMethod */; var checkFlags = isUnion ? 0 : 8 /* CheckFlags.Readonly */; var mergedInstantiations = false; @@ -347055,11 +347512,14 @@ var ts; var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment); var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0; if (prop) { - if (isUnion) { - optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */); - } - else { - optionalFlag &= prop.flags; + if (prop.flags & 106500 /* SymbolFlags.ClassMember */) { + optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */); + if (isUnion) { + optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */); + } + else { + optionalFlag &= prop.flags; + } } if (!singleProp) { singleProp = prop; @@ -347068,7 +347528,7 @@ var ts; var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp); // If the symbols are instances of one another with identical types - consider the symbols // equivalent and just use the first one, which thus allows us to avoid eliding private - // members when intersecting a (this-)instantiations of a class with it's raw base or another instance + // members when intersecting a (this-)instantiations of a class with its raw base or another instance if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) { // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used // to do when we recorded multiple distinct symbols so that we still get, eg, `Array.length` printed @@ -347116,7 +347576,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48 /* CheckFlags.Partial */) && + checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { // No property was found, or, in a union, a property has a private or protected declaration in one // constituent, but is missing or has a different declaration in another constituent. return undefined; @@ -347174,7 +347638,7 @@ var ts; propTypes.push(type); } ts.addRange(propTypes, indexTypes); - var result = createSymbol(4 /* SymbolFlags.Property */ | optionalFlag, name, syntheticFlag | checkFlags); + var result = createSymbol(4 /* SymbolFlags.Property */ | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags); result.containingType = containingType; if (!hasNonUniformValueDeclaration && firstValueDeclaration) { result.valueDeclaration = firstValueDeclaration; @@ -347218,6 +347682,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); // We need to filter out partial properties in union types @@ -347421,10 +347912,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJSFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ + node.type && node.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -347457,14 +347948,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -347546,7 +348037,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196 /* SyntaxKind.LiteralType */) { + if (type && type.kind === 198 /* SyntaxKind.LiteralType */) { flags |= 2 /* SignatureFlags.HasLiteralTypes */; } // Record a new minimum argument count if this is not an optional parameter @@ -347559,24 +348050,24 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) && + if ((declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + var otherKind = declaration.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 /* SyntaxKind.Constructor */ ? + var classType = declaration.kind === 173 /* SyntaxKind.Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1 /* SignatureFlags.HasRestParameter */; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128 /* ModifierFlags.Abstract */)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256 /* ModifierFlags.Abstract */)) { flags |= 4 /* SignatureFlags.Abstract */; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, @@ -347655,16 +348146,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && traverse(node.name); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return traverse(node.expression); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -347688,7 +348179,12 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible. + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -347719,7 +348215,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -347736,7 +348232,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 /* SyntaxKind.ThisType */ ? + return parameterName.kind === 194 /* SyntaxKind.ThisType */ ? createTypePredicate(node.assertsModifier ? 2 /* TypePredicateKind.AssertsThis */ : 0 /* TypePredicateKind.This */, /*parameterName*/ undefined, /*parameterIndex*/ undefined, type) : createTypePredicate(node.assertsModifier ? 3 /* TypePredicateKind.AssertsIdentifier */ : 1 /* TypePredicateKind.Identifier */, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -347782,7 +348278,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171 /* SyntaxKind.Constructor */) { + if (declaration.kind === 173 /* SyntaxKind.Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -347792,12 +348288,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173 /* SyntaxKind.SetAccessor */); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175 /* SyntaxKind.SetAccessor */); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -347900,7 +348396,7 @@ var ts; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; // If declaration is undefined, it is likely to be the signature of the default constructor. - var isConstructor = kind === undefined || kind === 171 /* SyntaxKind.Constructor */ || kind === 175 /* SyntaxKind.ConstructSignature */ || kind === 180 /* SyntaxKind.ConstructorType */; + var isConstructor = kind === undefined || kind === 173 /* SyntaxKind.Constructor */ || kind === 177 /* SyntaxKind.ConstructSignature */ || kind === 182 /* SyntaxKind.ConstructorType */; var type = createObjectType(16 /* ObjectFlags.Anonymous */); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -347927,7 +348423,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -347941,7 +348437,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -347958,14 +348454,14 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190 /* SyntaxKind.InferType */) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) { // When an 'infer T' declaration is immediately contained in a type reference node // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 180 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -347992,27 +348488,27 @@ var ts; } // When an 'infer T' declaration is immediately contained in a rest parameter declaration, a rest type // or a named rest tuple element, we infer an 'unknown[]' constraint. - else if (grandParent.kind === 164 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || - grandParent.kind === 186 /* SyntaxKind.RestType */ || - grandParent.kind === 197 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || + grandParent.kind === 188 /* SyntaxKind.RestType */ || + grandParent.kind === 199 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } // When an 'infer T' declaration is immediately contained in a string template type, we infer a 'string' // constraint. - else if (grandParent.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */) { + else if (grandParent.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */) { inferences = ts.append(inferences, stringType); } // When an 'infer T' declaration is in the constraint position of a mapped type, we infer a 'keyof any' // constraint. - else if (grandParent.kind === 163 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 195 /* SyntaxKind.MappedType */) { + else if (grandParent.kind === 165 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 197 /* SyntaxKind.MappedType */) { inferences = ts.append(inferences, keyofConstraintType); } // When an 'infer T' declaration is the template of a mapped type, and that mapped type is the extends // clause of a conditional whose check type is also a mapped type, give it a constraint equal to the template // of the check type's mapped type - else if (grandParent.kind === 195 /* SyntaxKind.MappedType */ && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 /* SyntaxKind.ConditionalType */ && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 /* SyntaxKind.MappedType */ && + else if (grandParent.kind === 197 /* SyntaxKind.MappedType */ && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 /* SyntaxKind.ConditionalType */ && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 /* SyntaxKind.MappedType */ && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -348022,7 +348518,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -348044,7 +348540,7 @@ var ts; if (type.flags & 1 /* TypeFlags.Any */ && !isErrorType(type)) { // Allow errorType to propegate to keep downstream errors suppressed // use keyofConstraintType as the base constraint for mapped type key constraints (unknown isn;t assignable to that, but `any` was), // use unknown otherwise - type = constraintDeclaration.parent.parent.kind === 195 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -348053,7 +348549,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163 /* SyntaxKind.TypeParameter */); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165 /* SyntaxKind.TypeParameter */); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -348139,8 +348635,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -348182,7 +348678,7 @@ var ts; return errorType; } } - if (node.kind === 178 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, /*mapper*/ undefined); } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -348253,9 +348749,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -348270,13 +348766,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? name.name : + var identifier = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -348337,7 +348833,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 /* SyntaxKind.ImportType */ && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 /* SyntaxKind.ImportType */ && node.qualifier; // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL} if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); @@ -348347,23 +348843,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 /* TypeFlags.AnyOrUnknown */ || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432 /* TypeFlags.Substitution */); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 1; + return node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -348373,16 +348873,16 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320 /* SyntaxKind.JSDoc */) { + while (node && !ts.isStatement(node) && node.kind !== 323 /* SyntaxKind.JSDoc */) { var parent = node.parent; // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax - if (parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 166 /* SyntaxKind.Parameter */) { covariant = !covariant; } // Always substitute on type parameters, regardless of variance, since even // in contravariant positions, they may rely on substituted constraints to be valid - if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 189 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { + if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 191 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); @@ -348390,7 +348890,7 @@ var ts; } // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the // template type XXX, K has an added constraint of number | `${number}`. - else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 195 /* SyntaxKind.MappedType */ && node === parent.type) { + else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 197 /* SyntaxKind.MappedType */ && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -348404,10 +348904,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 200 /* SyntaxKind.ImportType */); + return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 202 /* SyntaxKind.ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -348522,9 +349022,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declaration; } } @@ -348675,6 +349175,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -348692,11 +349199,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return 2 /* ElementFlags.Optional */; - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getRestTypeElementFlags(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return node.questionToken ? 2 /* ElementFlags.Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* ElementFlags.Required */; @@ -348714,14 +349221,14 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197 /* SyntaxKind.NamedTupleMember */; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199 /* SyntaxKind.NamedTupleMember */; }); return getTupleTargetType(elementFlags, readonly, /*associatedNames*/ missingName ? undefined : node.elements); } // Return true if the given type reference node is directly aliased or if it needs to be deferred // because it is possibly contained in a circular chain of eagerly resolved types. function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } // Return true when the given node is transitively contained in type constructs that eagerly @@ -348730,18 +349237,18 @@ var ts; function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 189 /* SyntaxKind.ConditionalType */: - case 193 /* SyntaxKind.TypeOperator */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 191 /* SyntaxKind.ConditionalType */: + case 195 /* SyntaxKind.TypeOperator */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return isResolvedByTypeAlias(parent); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } return false; @@ -348750,28 +349257,28 @@ var ts; // of a type alias. function mayResolveTypeAlias(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */).flags & 524288 /* SymbolFlags.TypeAlias */); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return true; - case 193 /* SyntaxKind.TypeOperator */: - return node.operator !== 154 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 195 /* SyntaxKind.TypeOperator */: + return node.operator !== 156 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 319 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 186 /* SyntaxKind.RestType */: - return node.type.kind !== 183 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 188 /* SyntaxKind.RestType */: + return node.type.kind !== 185 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return ts.some(node.types, mayResolveTypeAlias); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -348784,19 +349291,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : + else if (!(node.kind === 186 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, /*mapper*/ undefined); } else { - var elementTypes = node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + return ts.isTypeOperatorNode(node) && node.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -348911,7 +349418,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8 /* ElementFlags.Variadic */) { @@ -348941,9 +349448,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } // Turn optional elements preceding the last required element into required elements for (var i = 0; i < lastRequiredIndex; i++) { @@ -348971,7 +349478,7 @@ var ts; if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -349137,7 +349644,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -349145,7 +349652,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -349222,14 +349729,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -349719,7 +350226,7 @@ var ts; type.flags & 16777216 /* TypeFlags.Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* TypeFlags.UnionOrIntersection */ | 134217728 /* TypeFlags.TemplateLiteral */) ? ts.every(type.types, isDistributive) : type.flags & 8388608 /* TypeFlags.IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.substitute) : + type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* TypeFlags.StringMapping */ ? isDistributive(type.type) : false; } @@ -349800,15 +350307,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154 /* SyntaxKind.UniqueKeyword */: - links.resolvedType = node.type.kind === 151 /* SyntaxKind.SymbolKeyword */ + case 156 /* SyntaxKind.UniqueKeyword */: + links.resolvedType = node.type.kind === 153 /* SyntaxKind.SymbolKeyword */ ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -349844,8 +350351,14 @@ var ts; return getStringLiteralType(text); } newTexts.push(text); - if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) { - return stringType; + if (ts.every(newTexts, function (t) { return t === ""; })) { + if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) { + return stringType; + } + // Normalize `${Mapping}` into Mapping + if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) { + return newTypes[0]; + } } var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join("")); var type = templateLiteralTypes.get(id); @@ -349904,12 +350417,14 @@ var ts; } function getStringMappingType(symbol, type) { return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) : - // Mapping> === Mapping - type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type : - isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) : - type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : - type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : - type; + type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : + type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : + // Mapping> === Mapping + type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type : + type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : + // This handles Mapping<`${number}`> and Mapping<`${bigint}`> + isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) : + type; } function applyStringMapping(symbol, str) { switch (intrinsicTypeKinds.get(symbol.escapedName)) { @@ -350000,7 +350515,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256 /* AccessFlags.Contextual */) { @@ -350074,7 +350589,18 @@ var ts; return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; } errorIfWritingToReadonlyIndex(indexInfo); - return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; + // When accessing an enum object with its own type, + // e.g. E[E.A] for enum E { A }, undefined shouldn't + // be included in the result type + if ((accessFlags & 1 /* AccessFlags.IncludeUndefined */) && + !(objectType.symbol && + objectType.symbol.flags & (256 /* SymbolFlags.RegularEnum */ | 128 /* SymbolFlags.ConstEnum */) && + (indexType.symbol && + indexType.flags & 1024 /* TypeFlags.EnumLiteral */ && + getParentOfSymbol(indexType.symbol) === objectType.symbol))) { + return getUnionType([indexInfo.type, undefinedType]); + } + return indexInfo.type; } if (indexType.flags & 131072 /* TypeFlags.Never */) { return neverType; @@ -350171,16 +350697,17 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : - accessNode.kind === 194 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : - accessNode.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : + return accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : + accessNode.kind === 196 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : + accessNode.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { - return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type)); + return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type); } function isPatternLiteralType(type) { - return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType); + return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) || + !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type); } function isGenericType(type) { return !!getGenericObjectFlags(type); @@ -350202,7 +350729,7 @@ var ts; if (type.flags & 33554432 /* TypeFlags.Substitution */) { if (!(type.objectFlags & 2097152 /* ObjectFlags.IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* ObjectFlags.IsGenericTypeComputed */ | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912 /* ObjectFlags.IsGenericType */; } @@ -350353,7 +350880,7 @@ var ts; // for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 /* SyntaxKind.IndexedAccessType */ ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 /* SyntaxKind.IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -350405,11 +350932,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 /* TypeFlags.IndexedAccess */ && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -350463,18 +350986,23 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + // We loop here for an immediately nested conditional type in the false position, effectively treating + // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for + // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of + // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive + // cases we increment the tail recursion counter and stop after 1000 iterations. + while (true) { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; - return "break"; + break; } var isUnwrapped = isTypicalNondistributiveConditional(root); var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper); var checkTypeInstantiable = isGenericType(checkType); var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper); if (checkType === wildcardType || extendsType === wildcardType) { - return { value: wildcardType }; + return wildcardType; } var combinedMapper = void 0; if (root.inferTypeParameters) { @@ -350507,11 +351035,7 @@ var ts; } } } - // We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type - // if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to - // "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint - // so in those cases we refain from performing inference and retain the uninfered type parameter - if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) { + if (!checkTypeInstantiable) { // We don't want inferences from constraints as they may cause us to eagerly resolve the // conditional type instead of deferring resolution. Also, we always want strict function // types rules (i.e. proper contravariance) for inferences. @@ -350543,14 +351067,14 @@ var ts; var newRoot = falseType_1.root; if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) { root = newRoot; - return "continue"; + continue; } if (canTailRecurse(falseType_1, mapper)) { - return "continue"; + continue; } } result = instantiateType(falseType_1, mapper); - return "break"; + break; } // Return trueType for a definitely true extends check. We check instantiations of the two // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter @@ -350561,10 +351085,10 @@ var ts; var trueType_1 = getTypeFromTypeNode(root.node.trueType); var trueMapper = combinedMapper || mapper; if (canTailRecurse(trueType_1, trueMapper)) { - return "continue"; + continue; } result = instantiateType(trueType_1, trueMapper); - return "break"; + break; } } // Return a deferred type for a check that is neither definitely true nor definitely false @@ -350576,19 +351100,7 @@ var ts; result.combinedMapper = combinedMapper; result.aliasSymbol = aliasSymbol || root.aliasSymbol; result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217 - return "break"; - }; - // We loop here for an immediately nested conditional type in the false position, effectively treating - // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for - // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of - // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive - // cases we increment the tail recursion counter and stop after 1000 iterations. - while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") - break; + break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and @@ -350780,7 +351292,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -351025,7 +351537,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -351060,17 +351572,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 /* SyntaxKind.RestType */ || node.kind === 197 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 188 /* SyntaxKind.RestType */ || node.kind === 199 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return node.elementType; } return undefined; @@ -351086,99 +351598,99 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 131 /* SyntaxKind.AnyKeyword */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return anyType; - case 155 /* SyntaxKind.UnknownKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return unknownType; - case 150 /* SyntaxKind.StringKeyword */: + case 152 /* SyntaxKind.StringKeyword */: return stringType; - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return numberType; - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return bigintType; - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return booleanType; - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return esSymbolType; case 114 /* SyntaxKind.VoidKeyword */: return voidType; - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return undefinedType; case 104 /* SyntaxKind.NullKeyword */: // TODO(rbuckton): `NullKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service. return nullType; - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return neverType; - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return node.flags & 262144 /* NodeFlags.JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; - case 138 /* SyntaxKind.IntrinsicKeyword */: + case 139 /* SyntaxKind.IntrinsicKeyword */: return intrinsicMarkerType; - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: // TODO(rbuckton): `ThisKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service and because of `isPartOfTypeNode`. return getTypeFromThisTypeNode(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return getTypeFromLiteralTypeNode(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getTypeFromTypeReference(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return getTypeFromTypeQueryNode(node); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return getTypeFromOptionalTypeNode(node); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return getTypeFromUnionTypeNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getTypeFromRestTypeNode(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return getTypeFromMappedTypeNode(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return getTypeFromInferTypeNode(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return getTypeFromImportTypeNode(node); // This function assumes that an identifier, qualified name, or property access expression is a type expression // Callers should first ensure this by calling `isPartOfTypeNode` // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -351285,8 +351797,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* TypeMapKind.Merged */, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -351400,17 +351912,18 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { - // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks + // If the type parameter doesn't have exactly one declaration, if there are intervening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the - // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. + // type parameter, or if the node contains type queries that we can't prove couldn't contain references to the type parameter, + // we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 /* SyntaxKind.Block */ || n.kind === 189 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 /* SyntaxKind.Block */ || n.kind === 191 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -351419,15 +351932,36 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return !!tp.isThisType; case 79 /* SyntaxKind.Identifier */: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; // use worker because we're looking for === equality - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; // There is exactly one declaration, otherwise `containsReference` is not called + var tpScope_1; + if (tpDeclaration.kind === 165 /* SyntaxKind.TypeParameter */) { // Type parameter is a regular type parameter, e.g. foo + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + // Type parameter is the this type, and its declaration is the class declaration. + tpScope_1 = tpDeclaration; + } + else { + // Type parameter's declaration was unrecognized. + // This could happen if the type parameter comes from e.g. a JSDoc annotation, so we default to returning true. + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -351649,17 +352183,18 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432 /* TypeFlags.Substitution */) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752 /* TypeFlags.TypeVariable */) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + // A substitution type originates in the true branch of a conditional type and can be resolved + // to just the base type in the same cases as the conditional type resolves to its true branch + // (because the base type is then known to satisfy the constraint). + if (newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -351708,35 +352243,35 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return ts.some(node.elements, isContextSensitive); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return isContextSensitive(node.initializer); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isContextSensitive(node.expression); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285 /* SyntaxKind.JsxAttribute */: { + case 288 /* SyntaxKind.JsxAttribute */: { // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288 /* SyntaxKind.JsxExpression */: { + case 291 /* SyntaxKind.JsxExpression */: { // It is possible to that node.expression is undefined (e.g
) var expression = node.expression; return !!expression && isContextSensitive(expression); @@ -351745,15 +352280,14 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* SyntaxKind.Block */ && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -351854,23 +352388,23 @@ var ts; return true; } switch (node.kind) { - case 288 /* SyntaxKind.JsxExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 27 /* SyntaxKind.CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -352079,7 +352613,7 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: // child is of the type of the expression return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11 /* SyntaxKind.JsxText */: @@ -352088,9 +352622,9 @@ var ts; } // child is a string return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: // child is of type JSX.Element return { errorNode: child, innerExpression: child, nameType: nameType }; default: @@ -352238,11 +352772,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; - case 172 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; - case 169 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; - case 296 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; + case 175 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; + case 174 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; + case 171 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; + case 299 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; } return [3 /*break*/, 6]; case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -352315,8 +352849,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; - var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 169 /* SyntaxKind.MethodDeclaration */ && - kind !== 168 /* SyntaxKind.MethodSignature */ && kind !== 171 /* SyntaxKind.Constructor */; + var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 171 /* SyntaxKind.MethodDeclaration */ && + kind !== 170 /* SyntaxKind.MethodSignature */ && kind !== 173 /* SyntaxKind.Constructor */; var result = -1 /* Ternary.True */; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -352613,7 +353147,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 /* ObjectFlags.Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* TypeFlags.UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : type.substitute : + type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* TypeFlags.Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) @@ -353020,7 +353554,8 @@ var ts; return 0 /* Ternary.False */; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2 /* IntersectionState.Target */) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) && + !(intersectionState & 2 /* IntersectionState.Target */) && source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType && target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -353047,27 +353582,6 @@ var ts; var result_7 = skipCaching ? unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) : recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags); - // For certain combinations involving intersections and optional, excess, or mismatched properties we need - // an extra property check where the intersection is viewed as a single object. The following are motivating - // examples that all should be errors, but aren't without this extra property check: - // - // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property - // - // declare let wrong: { a: { y: string } }; - // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type - // - // function foo(x: { a?: string }, y: T & { a: boolean }) { - // x = y; // Mismatched property in source intersection - // } - // - // We suppress recursive intersection property checks because they can generate lots of work when relating - // recursive intersections that are structurally similar but not exactly identical. See #37854. - if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) || - isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) { - inPropertyCheck = true; - result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* IntersectionState.PropertyCheck */, recursionFlags); - inPropertyCheck = false; - } if (result_7) { return result_7; } @@ -353272,11 +353786,15 @@ var ts; // parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't // appear to be comparable to '2'. if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072 /* TypeFlags.Never */) { + return 0 /* Ternary.False */; + } if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) { - return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); + return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) || + isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); } } } @@ -353461,8 +353979,7 @@ var ts; if (overflow) { return 0 /* Ternary.False */; } - var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 /* IntersectionState.InPropertyCheck */ : 0); - var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false); + var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false); var entry = relation.get(id); if (entry !== undefined) { if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) { @@ -353492,7 +354009,7 @@ var ts; // A key that starts with "*" is an indication that we have type references that reference constrained // type parameters. For such keys we also check against the key we would have gotten if all type parameters // were unconstrained. - var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined; + var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined; for (var i = 0; i < maybeCount; i++) { // If source and target are already being compared, consider them related with assumptions if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) { @@ -353579,7 +354096,7 @@ var ts; function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) { var saveErrorInfo = captureErrorCalculationState(); var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo); - if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) { + if (relation !== identityRelation) { // The combined constraint of an intersection type is the intersection of the constraints of // the constituents. When an intersection type contains instantiable types with union type // constraints, there are situations where we need to examine the combined constraint. One is @@ -353593,10 +354110,33 @@ var ts; // needs to have its constraint hoisted into an intersection with said type parameter, this way // the type param can be compared with itself in the target (with the influence of its constraint to match other parts) // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)` - var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself - // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this - result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); + if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) { + var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); + if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself + // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this + result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); + } + } + // For certain combinations involving intersections and optional, excess, or mismatched properties we need + // an extra property check where the intersection is viewed as a single object. The following are motivating + // examples that all should be errors, but aren't without this extra property check: + // + // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property + // + // declare let wrong: { a: { y: string } }; + // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type + // + // function foo(x: { a?: string }, y: T & { a: boolean }) { + // x = y; // Mismatched property in source intersection + // } + // + // We suppress recursive intersection property checks because they can generate lots of work when relating + // recursive intersections that are structurally similar but not exactly identical. See #37854. + if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) || + isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) { + inPropertyCheck = true; + result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */); + inPropertyCheck = false; } } if (result) { @@ -353605,9 +354145,6 @@ var ts; return result; } function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) { - if (intersectionState & 4 /* IntersectionState.PropertyCheck */) { - return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */); - } var result; var originalErrorInfo; var varianceCheckFailed = false; @@ -353646,7 +354183,11 @@ var ts; } } if (sourceFlags & 33554432 /* TypeFlags.Substitution */) { - return isRelatedTo(source.substitute, target.substitute, 3 /* RecursionFlags.Both */, /*reportErrors*/ false); + if (result = isRelatedTo(source.baseType, target.baseType, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + return result; + } + } } if (!(sourceFlags & 524288 /* TypeFlags.Object */)) { return 0 /* Ternary.False */; @@ -353704,7 +354245,7 @@ var ts; // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!) var constraint = getConstraintOfTypeParameter(source); if (constraint && hasNonCircularBaseConstraint(source)) { - while (constraint && constraint.flags & 262144 /* TypeFlags.TypeParameter */) { + while (constraint && someType(constraint, function (c) { return !!(c.flags & 262144 /* TypeFlags.TypeParameter */); })) { if (result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)) { return result; } @@ -354360,7 +354901,7 @@ var ts; return 0 /* Ternary.False */; } // When checking for comparability, be more lenient with optional properties. - if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) { + if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && targetProp.flags & 106500 /* SymbolFlags.ClassMember */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) { // TypeScript 1.0 spec (April 2014): 3.8.3 // S is a subtype of a type T, and T is a supertype of S if ... // S' and T are object types and, for each member M in T.. @@ -354398,7 +354939,7 @@ var ts; shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, /*enclosingDeclaration*/ undefined, 0 /* SymbolFlags.None */, 4 /* SymbolFormatFlags.AllowAnyNodeKind */ | 16 /* SymbolFormatFlags.WriteComputedProps */); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -354647,7 +355188,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 /* SignatureKind.Construct */ && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171 /* SyntaxKind.Constructor */)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173 /* SyntaxKind.Constructor */)) { var constructSignatureToString = function (signature) { return signatureToString(signature, /*enclosingDeclaration*/ undefined, 262144 /* TypeFormatFlags.WriteArrowStyleSignature */, kind); }; @@ -355412,7 +355953,7 @@ var ts; var baseTypeNode = getBaseTypeNodeOfClass(target); // A base type expression may circularly reference the class itself (e.g. as an argument to function call), so we only // check for base types specified as simple qualified names. - if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 206 /* SyntaxKind.PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 208 /* SyntaxKind.PropertyAccessExpression */) { return undefined; } } @@ -355460,8 +356001,7 @@ var ts; return !!(type.flags & 109440 /* TypeFlags.Unit */); } function isUnitLikeType(type) { - return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) : - !!(type.flags & 109440 /* TypeFlags.Unit */); + return isUnitType(getBaseConstraintOrType(type)); } function extractUnitType(type) { return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type; @@ -355503,7 +356043,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -355598,7 +356138,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -355887,12 +356428,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 223 /* SyntaxKind.BinaryExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -355908,23 +356449,23 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { // Don't issue a suggestion for binding elements since the codefix doesn't yet support them. return; } break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* WideningKind.GeneratorYield */) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -355938,7 +356479,7 @@ var ts; wideningKind === 3 /* WideningKind.GeneratorYield */ ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -356055,7 +356596,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 /* SyntaxKind.MethodDeclaration */ ? + var contextualType = node.kind === 171 /* SyntaxKind.MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* ContextFlags.NoConstraints */) : getContextualType(node, 2 /* ContextFlags.NoConstraints */); if (contextualType) { @@ -356118,8 +356659,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259 /* SyntaxKind.TypeAliasDeclaration */); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 /* SyntaxKind.SourceFile */ ? true : n.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262 /* SyntaxKind.TypeAliasDeclaration */); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 /* SyntaxKind.SourceFile */ ? true : n.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); } return false; } @@ -356339,7 +356880,7 @@ var ts; && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) })); } function isMemberOfStringMapping(source, target) { - if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) { + if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) { return true; } if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) { @@ -356653,7 +357194,7 @@ var ts; } else if (source.flags & 33554432 /* TypeFlags.Substitution */) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority + inferWithPriority(getSubstitutionIntersection(source), target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority } else if (target.flags & 16777216 /* TypeFlags.Conditional */) { invokeOnce(source, target, inferToConditionalType); @@ -357135,7 +357676,7 @@ var ts; var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; // Once we descend into a bivariant signature we remain bivariant for all nested inferences - bivariant = bivariant || kind === 169 /* SyntaxKind.MethodDeclaration */ || kind === 168 /* SyntaxKind.MethodSignature */ || kind === 171 /* SyntaxKind.Constructor */; + bivariant = bivariant || kind === 171 /* SyntaxKind.MethodDeclaration */ || kind === 170 /* SyntaxKind.MethodSignature */ || kind === 173 /* SyntaxKind.Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -357334,7 +357875,7 @@ var ts; } // falls through default: - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -357355,7 +357896,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - return !!ts.findAncestor(node, function (n) { return n.kind === 181 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 161 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 163 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -357371,26 +357912,26 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: // Handle pseudo-references originating in getNarrowedTypeOfSymbol. return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } @@ -357398,16 +357939,16 @@ var ts; } function isMatchingReference(source, target) { switch (target.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isMatchingReference(source, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231 /* SyntaxKind.MetaProperty */: - return target.kind === 231 /* SyntaxKind.MetaProperty */ + case 233 /* SyntaxKind.MetaProperty */: + return target.kind === 233 /* SyntaxKind.MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79 /* SyntaxKind.Identifier */: @@ -357415,26 +357956,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 /* SyntaxKind.ThisKeyword */ : target.kind === 79 /* SyntaxKind.Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 /* SyntaxKind.VariableDeclaration */ || target.kind === 203 /* SyntaxKind.BindingElement */) && + (target.kind === 257 /* SyntaxKind.VariableDeclaration */ || target.kind === 205 /* SyntaxKind.BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108 /* SyntaxKind.ThisKeyword */: return target.kind === 108 /* SyntaxKind.ThisKeyword */; case 106 /* SyntaxKind.SuperKeyword */: return target.kind === 106 /* SyntaxKind.SuperKeyword */; - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source.right, target)); } return false; @@ -357465,7 +358006,7 @@ var ts; } if (ts.isEntityNameExpression(node.argumentExpression)) { var symbol = resolveEntityName(node.argumentExpression, 111551 /* SymbolFlags.Value */, /*ignoreErrors*/ true); - if (!symbol || !isConstVariable(symbol)) + if (!symbol || !(isConstVariable(symbol) || (symbol.flags & 8 /* SymbolFlags.EnumMember */))) return undefined; var declaration = symbol.valueDeclaration; if (declaration === undefined) @@ -357477,9 +358018,14 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); - return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); + if (initializer) { + return tryGetNameFromType(getTypeOfExpression(initializer)); + } + if (ts.isEnumMember(declaration)) { + return ts.getTextOfPropertyName(declaration.name); + } } } return undefined; @@ -357606,7 +358152,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -357623,7 +358169,7 @@ var ts; } } } - if (expression.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expression.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -357823,15 +358369,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, type, undefinedType, /*errorNode*/ undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -357848,21 +358394,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return stringType; - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkRightHandSideOfForOf(parent) || errorType; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return undefinedType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -357870,7 +358416,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ ? + var type = pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -357888,30 +358434,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.initializer && + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 /* SyntaxKind.BindingElement */ && node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + node.kind !== 205 /* SyntaxKind.BindingElement */ && node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 75 /* SyntaxKind.BarBarEqualsToken */: @@ -357926,13 +358472,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? + return parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -357951,13 +358497,13 @@ var ts; // Get the type names from all cases in a switch on `typeof`. The default clause and/or duplicate type names are // represented as undefined. Return undefined if one or more case clause expressions are not string literals. function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; + var text = clause.kind === 292 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -358144,12 +358690,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 /* SyntaxKind.CallExpression */ + parent.parent.kind === 210 /* SyntaxKind.CallExpression */ && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + var isElementAssignment = parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -358162,6 +358708,7 @@ var ts; ts.isInJSFile(node) && ts.hasInitializer(node) && node.initializer && ts.isFunctionExpressionOrArrowFunction(node.initializer) && ts.getEffectiveReturnTypeNode(node.initializer)); } function getExplicitTypeOfSymbol(symbol, diagnostic) { + symbol = resolveSymbol(symbol); if (symbol.flags & (16 /* SymbolFlags.Function */ | 8192 /* SymbolFlags.Method */ | 32 /* SymbolFlags.Class */ | 512 /* SymbolFlags.ValueModule */)) { return getTypeOfSymbol(symbol); } @@ -358177,7 +358724,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, /*diagnostic*/ undefined); if (expressionType) { @@ -358200,12 +358747,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node)); - return getExplicitTypeOfSymbol(symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol, diagnostic); + return getExplicitTypeOfSymbol(symbol, diagnostic); case 108 /* SyntaxKind.ThisKeyword */: return getExplicitThisType(node); case 106 /* SyntaxKind.SuperKeyword */: return checkSuperExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -358223,7 +358770,7 @@ var ts; } return undefined; } - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -358237,7 +358784,7 @@ var ts; // circularities in control flow analysis, we use getTypeOfDottedName when resolving the call // target expression of an assertion. var funcType = void 0; - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { funcType = getTypeOfDottedName(node.expression, /*diagnostic*/ undefined); } else if (node.expression.kind !== 106 /* SyntaxKind.SuperKeyword */) { @@ -358281,7 +358828,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -358402,8 +358949,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here. return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } @@ -358430,7 +358977,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = ts.getObjectFlags(evolvedType) & 256 /* ObjectFlags.EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { return declaredType; } // The non-null unknown type should never escape control flow analysis. @@ -358515,8 +359062,8 @@ var ts; // Check if we should continue with the control flow of the containing function. var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && - reference.kind !== 207 /* SyntaxKind.ElementAccessExpression */ && + reference.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && + reference.kind !== 209 /* SyntaxKind.ElementAccessExpression */ && reference.kind !== 108 /* SyntaxKind.ThisKeyword */) { flow = container.flowNode; continue; @@ -358541,7 +359088,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */ ? + return getNarrowableTypeForReference(node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } @@ -358581,14 +359128,14 @@ var ts; // in which case we continue control flow analysis back to the function's declaration if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 /* SyntaxKind.FunctionExpression */ || init.kind === 214 /* SyntaxKind.ArrowFunction */)) { + if (init && (init.kind === 215 /* SyntaxKind.FunctionExpression */ || init.kind === 216 /* SyntaxKind.ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } // for (const _ in ref) acts as a nonnull on ref - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } // Assignment doesn't affect reference @@ -358599,7 +359146,7 @@ var ts; if (node.kind === 95 /* SyntaxKind.FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { if (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -358630,7 +359177,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 /* SyntaxKind.CallExpression */ ? + var expr = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -358638,7 +359185,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* ObjectFlags.EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -358686,15 +359233,15 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { - type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { if (strictNullChecks) { if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 /* TypeFlags.Undefined */ | 131072 /* TypeFlags.Never */)); }); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 /* TypeFlags.Never */ || t.flags & 128 /* TypeFlags.StringLiteral */ && t.value === "undefined"); }); } } @@ -358922,7 +359469,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072 /* TypeFlags.Never */) && !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -358964,18 +359511,26 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; - } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 /* TypeFlags.Union */ - || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + return prop ? + !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; + } + function narrowTypeByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); }); + if (isKnownProperty) { + // If the check is for a known property (i.e. a property declared in some constituent of + // the target type), we filter the target type by presence of absence of the property. return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + // If the check is for an unknown property, we intersect the target type with `Record`, + // where X is the name of the property. + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -358992,10 +359547,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { + if (left.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { + if (right.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -359034,15 +359589,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128 /* TypeFlags.StringLiteral */) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowTypeByInKeyword(type, leftType, assumeTrue); } } break; @@ -359104,24 +359658,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) && - assumeTrue && - (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) { - if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) { - return valueType; - } - if (valueType.flags & 524288 /* TypeFlags.Object */) { - return nonPrimitiveType; - } - if (type.flags & 2 /* TypeFlags.Unknown */) { - return type; - } - } + var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; if (valueType.flags & 98304 /* TypeFlags.Nullable */) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; var facts = doubleEquals ? assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ : valueType.flags & 65536 /* TypeFlags.Null */ ? @@ -359130,10 +359671,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288 /* TypeFlags.Object */) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -359147,11 +359694,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */); @@ -359231,13 +359785,13 @@ var ts; neverType; }); } - function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { + function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement); if (!witnesses) { return type; } // Equal start and end denotes implicit fallthrough; undefined marks explicit default clause. - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290 /* SyntaxKind.DefaultClause */; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293 /* SyntaxKind.DefaultClause */; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { // In the default clause we filter constituents down to those that are not-equal to all handled cases. @@ -359441,17 +359995,17 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (expr.operator === 53 /* SyntaxKind.ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -359500,9 +360054,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 /* SyntaxKind.ModuleBlock */ || - node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 265 /* SyntaxKind.ModuleBlock */ || + node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; }); } // Check if a parameter or catch variable is assigned anywhere @@ -359545,7 +360099,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2 /* TypeSystemPropertyName.DeclaredType */)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 /* SyntaxKind.Parameter */ && + declaration.kind === 166 /* SyntaxKind.Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* TypeFacts.IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* TypeFacts.IsUndefined */); @@ -359562,10 +360116,10 @@ var ts; // In an element access obj[x], we consider obj to be in a constraint position, except when obj is of // a generic type without a nullable constraint and x is a generic type. This is because when both obj // and x are of generic types T and K, we want the resulting type to be T[K]. - return parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 161 /* SyntaxKind.QualifiedName */ || - parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === node || - parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && + return parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 163 /* SyntaxKind.QualifiedName */ || + parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === node || + parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -359619,15 +360173,15 @@ var ts; }); } function markAliasReferenced(symbol, location) { - if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) { var target = resolveAlias(symbol); - if (target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) { // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled // (because the const enum value will not be inlined), or if (2) the alias is an export // of a const enum declaration that will be preserved. if (compilerOptions.isolatedModules || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || - !isConstEnumOrConstEnumOnlyModule(target)) { + !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) { markAliasSymbolAsReferenced(symbol); } else { @@ -359664,15 +360218,16 @@ var ts; // destructuring from the narrowed parent type. if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 166 /* SyntaxKind.Parameter */) { var links = getNodeLinks(parent); if (!(links.flags & 268435456 /* NodeCheckFlags.InCheckIdentifier */)) { links.flags |= 268435456 /* NodeCheckFlags.InCheckIdentifier */; var parentType = getTypeForBindingElementParent(parent, 0 /* CheckMode.Normal */); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456 /* NodeCheckFlags.InCheckIdentifier */; - if (parentType && parentType.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 164 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 166 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ undefined, location.flowNode); if (narrowedType.flags & 131072 /* TypeFlags.Never */) { return neverType; } @@ -359739,10 +360294,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ScriptTarget.ES2015 */) { - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + else if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -359762,7 +360317,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -359774,12 +360329,12 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (declaration.kind === 228 /* SyntaxKind.ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); - while (container.kind !== 305 /* SyntaxKind.SourceFile */) { + while (container.kind !== 308 /* SyntaxKind.SourceFile */) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; @@ -359837,7 +360392,7 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 164 /* SyntaxKind.Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 166 /* SyntaxKind.Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; @@ -359846,19 +360401,19 @@ var ts; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 /* SyntaxKind.FunctionExpression */ || - flowContainer.kind === 214 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* SyntaxKind.FunctionExpression */ || + flowContainer.kind === 216 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } // We only look for uninitialized variables in strict null checking mode, and only when we can analyze // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). - var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || + var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) || - node.parent.kind === 230 /* SyntaxKind.NonNullExpression */ || - declaration.kind === 254 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) || + node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ || + declaration.kind === 257 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* NodeFlags.Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -359883,6 +360438,12 @@ var ts; } return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } + function isSameScopedBindingElement(node, declaration) { + if (ts.isBindingElement(declaration)) { + var bindingElement = ts.findAncestor(node, ts.isBindingElement); + return bindingElement && ts.getRootDeclaration(bindingElement) === ts.getRootDeclaration(declaration); + } + } function shouldMarkIdentifierAliasReferenced(node) { var _a; var parent = node.parent; @@ -359916,7 +360477,7 @@ var ts; (symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 32 /* SymbolFlags.Class */)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292 /* SyntaxKind.CatchClause */) { + symbol.valueDeclaration.parent.kind === 295 /* SyntaxKind.CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -359931,7 +360492,7 @@ var ts; // mark iteration statement as containing block-scoped binding captured in some function var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -359952,7 +360513,7 @@ var ts; // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */; } @@ -359971,7 +360532,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (current.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -359979,7 +360540,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */)) { + else if ((current.parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; } @@ -359992,7 +360553,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* NodeCheckFlags.LexicalThis */; - if (container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || container.kind === 173 /* SyntaxKind.Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* NodeCheckFlags.CaptureThis */; } @@ -360039,31 +360600,31 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var capturedByArrowFunction = false; - if (container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -360151,7 +360712,7 @@ var ts; } function getClassNameFromPrototypeMethod(container) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } - if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3 /* AssignmentDeclarationKind.PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = container' @@ -360161,16 +360722,16 @@ var ts; .expression; // x } // x.prototype = { method() { } } - else if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && - container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && + container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.left.expression; } // x.prototype = { method: function() { } } - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && - container.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && - container.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && + container.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && + container.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.parent.left.expression; @@ -360178,7 +360739,7 @@ var ts; // Object.defineProperty(x, "method", { value: function() { } }); // Object.defineProperty(x, "method", { set: (x: () => void) => void }); // Object.defineProperty(x, "method", { get: () => function() { }) }); - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -360203,7 +360764,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317 /* SyntaxKind.JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 320 /* SyntaxKind.JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -360217,19 +360778,24 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 /* SyntaxKind.CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 /* SyntaxKind.CallExpression */ && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var container = immediateContainer; var needToCaptureLexicalThis = false; + var inAsyncFunction = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 214 /* SyntaxKind.ArrowFunction */) { + while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) { + if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) + inAsyncFunction = true; container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */; } + if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) + inAsyncFunction = true; } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; @@ -360239,14 +360805,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162 /* SyntaxKind.ComputedPropertyName */; }); - if (current && current.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164 /* SyntaxKind.ComputedPropertyName */; }); + if (current && current.kind === 164 /* SyntaxKind.ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -360254,7 +360820,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171 /* SyntaxKind.Constructor */) { + if (!isCallExpression && immediateContainer.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -360335,12 +360901,12 @@ var ts; // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { - getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */; + getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */; } else { - getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.AsyncMethodWithSuper */; + getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */; } } if (needToCaptureLexicalThis) { @@ -360349,7 +360915,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -360370,7 +360936,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; @@ -360385,7 +360951,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 173 /* SyntaxKind.Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -360393,23 +360959,23 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (ts.isStatic(container)) { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } else { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 166 /* SyntaxKind.PropertySignature */ || - container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 168 /* SyntaxKind.PropertySignature */ || + container.kind === 173 /* SyntaxKind.Constructor */; } } } @@ -360417,10 +360983,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 /* SyntaxKind.MethodDeclaration */ || - func.kind === 172 /* SyntaxKind.GetAccessor */ || - func.kind === 173 /* SyntaxKind.SetAccessor */) && func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : - func.kind === 213 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : + return (func.kind === 171 /* SyntaxKind.MethodDeclaration */ || + func.kind === 174 /* SyntaxKind.GetAccessor */ || + func.kind === 175 /* SyntaxKind.SetAccessor */) && func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : + func.kind === 215 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -360432,7 +360998,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -360459,7 +361025,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (literal.parent.kind !== 299 /* SyntaxKind.PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -360473,7 +361039,7 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -360526,11 +361092,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return getContextuallyTypedParameterType(declaration); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -360541,10 +361107,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); + parent.kind !== 205 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (parent.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -360701,7 +361267,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (template.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -360820,9 +361386,11 @@ var ts; case 1 /* AssignmentDeclarationKind.ExportsProperty */: case 6 /* AssignmentDeclarationKind.Prototype */: case 3 /* AssignmentDeclarationKind.PrototypeProperty */: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; - // falls through case 2 /* AssignmentDeclarationKind.ModuleExports */: + var valueDeclaration = void 0; + if (kind !== 2 /* AssignmentDeclarationKind.ModuleExports */) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -360999,21 +361567,21 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 79 /* SyntaxKind.Identifier */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -361034,9 +361602,10 @@ var ts; function instantiateContextualType(contextualType, node, contextFlags) { if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* TypeFlags.Instantiable */)) { var inferenceContext = getInferenceContext(node); - // If no inferences have been made, nothing is gained from instantiating as type parameters - // would just be replaced with their defaults similar to the apparent type. - if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidates)) { + // If no inferences have been made, and none of the type parameters for which we are inferring + // specify default types, nothing is gained from instantiating as type parameters would just be + // replaced with their constraints similar to the apparent type. + if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) { // For contextual signatures we incorporate all inferences made so far, e.g. from return // types as well as arguments to the left in a function call. return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); @@ -361096,60 +361665,62 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214 /* SyntaxKind.ArrowFunction */: - case 247 /* SyntaxKind.ReturnStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 250 /* SyntaxKind.ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return getContextualTypeForArgument(parent, node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return getContextualType(parent.parent, contextFlags); - case 204 /* SyntaxKind.ArrayLiteralExpression */: { + case 206 /* SyntaxKind.ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 223 /* SyntaxKind.TemplateExpression */); + case 236 /* SyntaxKind.TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 225 /* SyntaxKind.TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return getContextualType(parent, contextFlags); - case 271 /* SyntaxKind.ExportAssignment */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return getTypeFromTypeNode(parent.type); + case 274 /* SyntaxKind.ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -361275,9 +361846,16 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + // apply JSX.IntrinsicClassElements + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + // or JSX.IntrinsicClassElements has no generics. + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -361400,7 +361978,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -361448,8 +362026,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 /* SyntaxKind.BindingElement */ && !!node.initializer) || - (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); + return (node.kind === 205 /* SyntaxKind.BindingElement */ && !!node.initializer) || + (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -361462,7 +362040,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* ExternalEmitHelpers.SpreadIncludes */ : 1024 /* ExternalEmitHelpers.SpreadArray */); } @@ -361495,7 +362073,7 @@ var ts; elementFlags.push(4 /* ElementFlags.Rest */); } } - else if (exactOptionalPropertyTypes && e.kind === 227 /* SyntaxKind.OmittedExpression */) { + else if (exactOptionalPropertyTypes && e.kind === 229 /* SyntaxKind.OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2 /* ElementFlags.Optional */); @@ -361535,7 +362113,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return isNumericComputedName(name); case 79 /* SyntaxKind.Identifier */: return ts.isNumericLiteralName(name.escapedText); @@ -361556,7 +362134,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ - && node.parent.kind !== 172 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 173 /* SyntaxKind.SetAccessor */) { + && node.parent.kind !== 174 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 175 /* SyntaxKind.SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -361629,7 +362207,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* SyntaxKind.ObjectLiteralExpression */); + (contextualType.pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* SyntaxKind.ObjectLiteralExpression */); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 /* CheckFlags.Readonly */ : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -361653,16 +362231,16 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ || + if (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : + var type = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. // we don't want to say "could not find 'a'". - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -361685,8 +362263,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* SymbolFlags.Optional */; } @@ -361712,14 +362290,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 /* CheckMode.Inferential */ && !(checkMode & 4 /* CheckMode.SkipContextSensitive */) && - (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 169 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 171 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context - var inferenceNode = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (memberDecl.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* ExternalEmitHelpers.Assign */); } @@ -361755,7 +362333,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 172 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 173 /* SyntaxKind.SetAccessor */); + ts.Debug.assert(memberDecl.kind === 174 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 175 /* SyntaxKind.SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */)) { @@ -361782,16 +362360,30 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. // If the object literal is spread into another object literal, skip this step and let the top-level object - // literal handle it instead. - if (contextualTypeHasPattern && node.parent.kind !== 298 /* SyntaxKind.SpreadAssignment */) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + // literal handle it instead. Note that this might require full traversal to the root pattern's parent + // as it's the guaranteed to be the common ancestor of the pattern node and the current object node. + // It's not possible to check if the immediate parent node is a spread assignment + // since the type flows in non-obvious ways through conditional expressions, IIFEs and more. + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 /* SyntaxKind.VariableDeclaration */ || + n.kind === 223 /* SyntaxKind.BinaryExpression */ || + n.kind === 166 /* SyntaxKind.Parameter */; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301 /* SyntaxKind.SpreadAssignment */; + }); + if (spreadOrOutsideRootObject.kind !== 301 /* SyntaxKind.SpreadAssignment */) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -361899,6 +362491,7 @@ var ts; */ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -361926,9 +362519,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287 /* SyntaxKind.JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 290 /* SyntaxKind.JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = ts.createSymbolTable(); @@ -361955,7 +362554,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 278 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); @@ -362012,7 +362611,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 /* SyntaxKind.JsxExpression */ && !child.expression) { + else if (child.kind === 291 /* SyntaxKind.JsxExpression */ && !child.expression) { continue; // empty jsx expressions don't *really* count as present children } else { @@ -362444,9 +363043,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 /* SyntaxKind.QualifiedName */ ? node.right : - node.kind === 200 /* SyntaxKind.ImportType */ ? node : - node.kind === 203 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; + node.kind === 163 /* SyntaxKind.QualifiedName */ ? node.right : + node.kind === 202 /* SyntaxKind.ImportType */ ? node : + node.kind === 205 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } /** @@ -362477,7 +363076,7 @@ var ts; return false; } } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -362489,7 +363088,7 @@ var ts; } } // Referencing abstract properties within their own constructors is not allowed - if ((flags & 128 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -362583,10 +363182,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104 /* SyntaxKind.NullKeyword */) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? @@ -362596,6 +363212,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -362613,6 +363236,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384 /* TypeFlags.Void */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -362631,7 +363265,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -362771,7 +363405,7 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* SyntaxKind.QualifiedName */); + prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 163 /* SyntaxKind.QualifiedName */); } // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums. // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined @@ -362781,7 +363415,7 @@ var ts; // 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and // 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`. if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 299 /* SyntaxKind.EnumMember */)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 302 /* SyntaxKind.EnumMember */)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -362883,7 +363517,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { + if (flowContainer.kind === 173 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { assumeUninitialized = true; } } @@ -362918,8 +363552,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 /* SyntaxKind.ClassDeclaration */ && - node.parent.kind !== 178 /* SyntaxKind.TypeReference */ && + else if (valueDeclaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && + node.parent.kind !== 180 /* SyntaxKind.TypeReference */ && !(valueDeclaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -362931,25 +363565,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 298 /* SyntaxKind.SpreadAssignment */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 233 /* SyntaxKind.TemplateSpan */: - case 288 /* SyntaxKind.JsxExpression */: - case 285 /* SyntaxKind.JsxAttribute */: - case 286 /* SyntaxKind.JsxAttributes */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 291 /* SyntaxKind.HeritageClause */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 301 /* SyntaxKind.SpreadAssignment */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 236 /* SyntaxKind.TemplateSpan */: + case 291 /* SyntaxKind.JsxExpression */: + case 288 /* SyntaxKind.JsxAttribute */: + case 289 /* SyntaxKind.JsxAttributes */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 294 /* SyntaxKind.HeritageClause */: return false; - case 214 /* SyntaxKind.ArrowFunction */: - case 238 /* SyntaxKind.ExpressionStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -363144,7 +363778,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -363224,11 +363857,11 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return isValidPropertyAccessWithType(node, node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left))); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node)); } } @@ -363243,7 +363876,7 @@ var ts; * @param property the accessed property's symbol. */ function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, + return isPropertyAccessible(node, node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, /* isWrite */ false, type, property); // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } @@ -363283,7 +363916,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -363312,7 +363945,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 /* SyntaxKind.ForInStatement */ && + if (node.kind === 246 /* SyntaxKind.ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -363361,13 +363994,13 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165 /* SyntaxKind.Decorator */) { + else if (node.kind !== 167 /* SyntaxKind.Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -363431,7 +364064,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 /* SyntaxKind.SpreadElement */ || arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 227 /* SyntaxKind.SpreadElement */ || arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -363448,9 +364081,9 @@ var ts; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (node.template.kind === 225 /* SyntaxKind.TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span. @@ -363465,7 +364098,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165 /* SyntaxKind.Decorator */) { + else if (node.kind === 167 /* SyntaxKind.Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -363479,7 +364112,7 @@ var ts; } else if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 209 /* SyntaxKind.NewExpression */); + ts.Debug.assert(node.kind === 211 /* SyntaxKind.NewExpression */); return getMinArgumentCount(signature) === 0; } else { @@ -363582,7 +364215,7 @@ var ts; // example, given a 'function wrap(cb: (x: T) => U): (x: T) => U' and a call expression // 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the // return type of 'wrap'. - if (node.kind !== 165 /* SyntaxKind.Decorator */) { + if (node.kind !== 167 /* SyntaxKind.Decorator */) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* ContextFlags.SkipBindingPatterns */ : 0 /* ContextFlags.None */); if (contextualType) { @@ -363646,7 +364279,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -363672,7 +364305,7 @@ var ts; if (isSpreadArgument(arg)) { // We are inferring from a spread expression in the last argument position, i.e. both the parameter // and the argument are ...x forms. - return getMutableArrayOrTupleType(arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -363682,13 +364315,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* ElementFlags.Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 225 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 227 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); flags.push(4 /* ElementFlags.Rest */); } } @@ -363699,7 +364332,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* ElementFlags.Required */); } - if (arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -363843,7 +364476,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209 /* SyntaxKind.NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 211 /* SyntaxKind.NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -363861,7 +364494,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode); // If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive), @@ -363906,8 +364539,8 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - var expression = node.kind === 208 /* SyntaxKind.CallExpression */ ? node.expression : - node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; + var expression = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression : + node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -363925,17 +364558,17 @@ var ts; * Returns the effective arguments for an expression that works like a function invocation. */ function getEffectiveCallArguments(node) { - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165 /* SyntaxKind.Decorator */) { + if (node.kind === 167 /* SyntaxKind.Decorator */) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -363949,7 +364582,7 @@ var ts; var _loop_26 = function (i) { var arg = args[i]; // We can call checkExpressionCached because spread expressions never have a contextual type. - var spreadType = arg.kind === 225 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -363976,30 +364609,30 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class). return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts). var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - var hasPropDesc = parent.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && languageVersion !== 0 /* ScriptTarget.ES3 */; + var hasPropDesc = languageVersion !== 0 /* ScriptTarget.ES3 */ && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -364013,17 +364646,17 @@ var ts; */ function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return 1; - case 167 /* SyntaxKind.PropertyDeclaration */: - return 2; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // For ES3 or decorators with only two parameters we supply only two arguments return languageVersion === 0 /* ScriptTarget.ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return 3; default: return ts.Debug.fail(); @@ -364165,8 +364798,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; - var isDecorator = node.kind === 165 /* SyntaxKind.Decorator */; + var isTaggedTemplate = node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; + var isDecorator = node.kind === 167 /* SyntaxKind.Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -364229,7 +364862,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 208 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 210 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -364718,7 +365351,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128 /* ModifierFlags.Abstract */)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256 /* ModifierFlags.Abstract */)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -364789,7 +365422,7 @@ var ts; var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24 /* ModifierFlags.NonPublicAccessibilityModifier */); // (1) Public constructors and (2) constructor functions are always accessible. - if (!modifiers || declaration.kind !== 171 /* SyntaxKind.Constructor */) { + if (!modifiers || declaration.kind !== 173 /* SyntaxKind.Constructor */) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -364933,16 +365566,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -364988,7 +365621,7 @@ var ts; // file would probably be preferable. var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* SymbolFlags.Type */); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* SymbolFlags.Type */, node); - var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); var parameterSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "props"); parameterSymbol.type = result; return createSignature(declaration, @@ -365037,16 +365670,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -365090,12 +365723,15 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { - // If the node has a @class tag, treat it like a constructor. + // If the node has a @class or @constructor tag, treat it like a constructor. if (ts.getJSDocClassTag(node)) return true; + // If the node is a property of an object literal. + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; // If the symbol of the node has members, treat it like a constructor. var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); @@ -365178,7 +365814,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -365204,12 +365840,12 @@ var ts; if (node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { return voidType; } - if (node.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.kind === 211 /* SyntaxKind.NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 /* SyntaxKind.Constructor */ && - declaration.kind !== 175 /* SyntaxKind.ConstructSignature */ && - declaration.kind !== 180 /* SyntaxKind.ConstructorType */ && + declaration.kind !== 173 /* SyntaxKind.Constructor */ && + declaration.kind !== 177 /* SyntaxKind.ConstructSignature */ && + declaration.kind !== 182 /* SyntaxKind.ConstructorType */ && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any @@ -365229,7 +365865,7 @@ var ts; if (returnType.flags & 12288 /* TypeFlags.ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + if (node.kind === 210 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && returnType.flags & 16384 /* TypeFlags.Void */ && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -365259,20 +365895,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 165 /* SyntaxKind.Decorator */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 167 /* SyntaxKind.Decorator */: + case 211 /* SyntaxKind.NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.argumentExpression; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -365343,8 +365979,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -365387,9 +366023,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* SymbolFlags.Function */ - ? 256 /* SyntaxKind.FunctionDeclaration */ + ? 259 /* SyntaxKind.FunctionDeclaration */ : resolvedRequire.flags & 3 /* SymbolFlags.Variable */ - ? 254 /* SyntaxKind.VariableDeclaration */ + ? 257 /* SyntaxKind.VariableDeclaration */ : 0 /* SyntaxKind.Unknown */; if (targetDeclarationKind !== 0 /* SyntaxKind.Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -365409,7 +366045,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Extension.Cts */, ".mts" /* Extension.Mts */])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -365425,25 +366061,25 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var op = node.operator; var arg = node.operand; return op === 40 /* SyntaxKind.MinusToken */ && (arg.kind === 8 /* SyntaxKind.NumericLiteral */ || arg.kind === 9 /* SyntaxKind.BigIntLiteral */) || op === 39 /* SyntaxKind.PlusToken */ && arg.kind === 8 /* SyntaxKind.NumericLiteral */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) { symbol = resolveAlias(symbol); } - return !!(symbol && (symbol.flags & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */); + return !!(symbol && (getAllSymbolFlags(symbol) & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */); } return false; } @@ -365479,7 +366115,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : + var exprType = node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -365543,6 +366179,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103 /* SyntaxKind.NewKeyword */) { @@ -365570,7 +366216,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -365622,7 +366268,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317 /* SyntaxKind.JSDocFunctionType */) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDocFunctionType */) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -365654,7 +366300,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -365946,7 +366592,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235 /* SyntaxKind.Block */) { // Async or normal arrow function + if (func.body.kind !== 238 /* SyntaxKind.Block */) { // Async or normal arrow function returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* CheckMode.SkipGenericFunctions */); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -366095,15 +366741,25 @@ var ts; } function isExhaustiveSwitchStatement(node) { var links = getNodeLinks(node); - return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); + if (links.isExhaustive === undefined) { + links.isExhaustive = 0; // Indicate resolution is in process + var exhaustive = computeExhaustiveSwitchStatement(node); + if (links.isExhaustive === 0) { + links.isExhaustive = exhaustive; + } + } + else if (links.isExhaustive === 0) { + links.isExhaustive = false; // Resolve circularity to false + } + return links.isExhaustive; } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216 /* SyntaxKind.TypeOfExpression */) { + if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; } - var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression)); + var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression)); // Get the not-equal flags for all handled cases. var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses); if (operandConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -366113,7 +366769,7 @@ var ts; // A missing not-equal flag indicates that the type wasn't handled by some case. return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; }); } - var type = getTypeOfExpression(node.expression); + var type = checkExpressionCached(node.expression); if (!isLiteralType(type)) { return false; } @@ -366164,11 +366820,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: - return func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + case 171 /* SyntaxKind.MethodDeclaration */: + return func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; default: return false; } @@ -366194,7 +366850,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (func.kind === 168 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 235 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 170 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 238 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512 /* NodeFlags.HasExplicitReturn */; @@ -366228,7 +366884,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -366255,7 +366911,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (!hasGrammarError && node.kind === 215 /* SyntaxKind.FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -366306,7 +366962,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -366319,7 +366975,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body.kind === 238 /* SyntaxKind.Block */) { checkSourceElement(node.body); } else { @@ -366409,7 +367065,7 @@ var ts; expr.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -366434,7 +367090,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152 /* SymbolFlags.Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268 /* SyntaxKind.NamespaceImport */; + return !!declaration && declaration.kind === 271 /* SyntaxKind.NamespaceImport */; } } } @@ -366534,7 +367190,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { + if (container && container.kind !== 173 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -366702,6 +367358,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -366718,40 +367377,20 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // Require the left operand to be of type Any, the String primitive type, or the Number primitive type. - if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) || - isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); + // The type of the lef operand must be assignable to string, number, or symbol. + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); + } + // The type of the right operand must be assignable to 'object'. + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we + // detect and error on {} that results from narrowing the unknown type, as well as intersections + // that include {} (we know that the other types in such intersections are assignable to object + // since we already checked for that). + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); } } - rightType = checkNonNullType(rightType, right); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // The in operator requires the right operand to be - // - // 1. assignable to the non-primitive type, - // 2. an unconstrained type parameter, - // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the - // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the - // non-primitive type, or - // 4. a type parameter whose constraint is - // i. an object type, - // ii. the non-primitive type, or - // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type. - // - // The divergent behavior for type parameters and unions containing type parameters is a workaround for type - // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance - // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error - // unless *all* instantiations would result in an error. - // // The result is always of the Boolean primitive type. - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); - } return booleanType; } function checkObjectLiteralAssignment(node, sourceType, rightIsThis) { @@ -366769,7 +367408,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */ || property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */ || property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -366782,9 +367421,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* AccessFlags.ExpressionPosition */, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); } - else if (property.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (property.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -366822,7 +367461,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225 /* SyntaxKind.SpreadElement */) { + if (node.elements[i].kind === 227 /* SyntaxKind.SpreadElement */) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -366832,8 +367471,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227 /* SyntaxKind.OmittedExpression */) { - if (element.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (element.kind !== 229 /* SyntaxKind.OmittedExpression */) { + if (element.kind !== 227 /* SyntaxKind.SpreadElement */) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { // We create a synthetic expression so that getIndexedAccessType doesn't get confused @@ -366851,7 +367490,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (restExpression.kind === 223 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -366867,7 +367506,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -366883,7 +367522,7 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (target.kind === 223 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; // A default value is specified, so remove undefined from the final type. @@ -366891,20 +367530,20 @@ var ts; sourceType = getTypeWithFacts(sourceType, 524288 /* TypeFacts.NEUndefined */); } } - if (target.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (target.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + if (target.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var error = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var optionalError = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -366929,36 +367568,36 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 10 /* SyntaxKind.StringLiteral */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: return true; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -366970,9 +367609,9 @@ var ts; } return false; // Some forms listed here for clarity - case 217 /* SyntaxKind.VoidExpression */: // Explicit opt-out - case 211 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 229 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings + case 219 /* SyntaxKind.VoidExpression */: // Explicit opt-out + case 213 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 231 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -367009,7 +367648,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108 /* SyntaxKind.ThisKeyword */)); return state; @@ -367031,11 +367670,11 @@ var ts; if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || operator === 56 /* SyntaxKind.BarBarToken */ || operator === 60 /* SyntaxKind.QuestionQuestionToken */) { if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */) { var parent = node.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -367106,7 +367745,7 @@ var ts; // expression-wide checks and does not use a work stack to fold nested binary expressions into the same callstack frame function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108 /* SyntaxKind.ThisKeyword */); } var leftType; @@ -367262,6 +367901,7 @@ var ts; var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102 /* SyntaxKind.InstanceOfKeyword */: @@ -367457,20 +368097,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: case 34 /* SyntaxKind.EqualsEqualsToken */: - typeName = "false"; - break; case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -367551,8 +368206,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */); @@ -367581,7 +368236,7 @@ var ts; type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* TypeFlags.StringLike */)); } function getContextNode(node) { - if (node.kind === 286 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes) } return node; @@ -367635,8 +368290,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */ || - node.kind === 229 /* SyntaxKind.AsExpression */ || + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */ || + node.kind === 231 /* SyntaxKind.AsExpression */ || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -367645,7 +368300,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* CheckMode.Normal */) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && + return ts.isParameter(declaration) && declaration.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -367655,7 +368310,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, /*includePatternInType*/ false, /*reportErrors*/ false) : anyType); elementFlags.push(2 /* ElementFlags.Optional */); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -367723,7 +368378,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); @@ -367734,7 +368389,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -367808,6 +368463,9 @@ var ts; function hasInferenceCandidates(info) { return !!(info.candidates || info.contraCandidates); } + function hasInferenceCandidatesOrDefault(info) { + return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter)); + } function hasOverlappingInferences(a, b) { for (var i = 0; i < a.length; i++) { if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) { @@ -367977,11 +368635,11 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || - (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums + var ok = (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || + (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -368006,9 +368664,9 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -368039,80 +368697,82 @@ var ts; return trueType; case 95 /* SyntaxKind.FalseKeyword */: return falseType; - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return checkTemplateExpression(node); case 13 /* SyntaxKind.RegularExpressionLiteral */: return globalRegExpType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return checkQualifiedName(node, checkMode); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (node.expression.kind === 100 /* SyntaxKind.ImportKeyword */) { return checkImportCallExpression(node); } // falls through - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checkCallExpression(node, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return checkClassExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return checkTypeOfExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return checkAssertion(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return checkNonNullAssertion(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return checkSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return checkMetaProperty(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkDeleteExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return checkVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return checkAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return checkSpreadExpression(node, checkMode); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return undefinedWideningType; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return checkYieldExpression(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return checkSyntheticExpression(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return checkJsxExpression(node, checkMode); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return checkJsxElement(node, checkMode); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return checkJsxFragment(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -368171,10 +368831,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { - if (!(func.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -368185,13 +368845,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 /* SyntaxKind.Constructor */ || func.kind === 175 /* SyntaxKind.ConstructSignature */ || func.kind === 180 /* SyntaxKind.ConstructorType */) { + if (func.kind === 173 /* SyntaxKind.Constructor */ || func.kind === 177 /* SyntaxKind.ConstructSignature */ || func.kind === 182 /* SyntaxKind.ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 /* SyntaxKind.GetAccessor */ || func.kind === 173 /* SyntaxKind.SetAccessor */) { + if (func.kind === 174 /* SyntaxKind.GetAccessor */ || func.kind === 175 /* SyntaxKind.SetAccessor */) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -368249,13 +368909,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 179 /* SyntaxKind.FunctionType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 181 /* SyntaxKind.FunctionType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var parent = node.parent; if (node === parent.type) { return parent; @@ -368273,7 +368933,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + else if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -368282,13 +368942,13 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 176 /* SyntaxKind.IndexSignature */) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */) { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 179 /* SyntaxKind.FunctionType */ || node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 180 /* SyntaxKind.ConstructorType */ || - node.kind === 174 /* SyntaxKind.CallSignature */ || node.kind === 171 /* SyntaxKind.Constructor */ || - node.kind === 175 /* SyntaxKind.ConstructSignature */) { + else if (node.kind === 181 /* SyntaxKind.FunctionType */ || node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 182 /* SyntaxKind.ConstructorType */ || + node.kind === 176 /* SyntaxKind.CallSignature */ || node.kind === 173 /* SyntaxKind.Constructor */ || + node.kind === 177 /* SyntaxKind.ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -368320,10 +368980,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -368353,7 +369013,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 317 /* SyntaxKind.JSDocFunctionType */) { + if (node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 320 /* SyntaxKind.JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -368365,7 +369025,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */) { + if (member.kind === 173 /* SyntaxKind.Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -368387,16 +369047,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: addName(names, name, memberName, 1 /* DeclarationMeaning.GetAccessor */ | privateStaticFlags); break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: addName(names, name, memberName, 2 /* DeclarationMeaning.SetAccessor */ | privateStaticFlags); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: addName(names, name, memberName, 3 /* DeclarationMeaning.GetOrSetAccessor */ | privateStaticFlags); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: addName(names, name, memberName, 8 /* DeclarationMeaning.Method */ | privateStaticFlags); break; } @@ -368468,7 +369128,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166 /* SyntaxKind.PropertySignature */) { + if (member.kind === 168 /* SyntaxKind.PropertySignature */) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -368493,7 +369153,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -368541,7 +369201,7 @@ var ts; checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); // property signatures already report "initializer not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -368561,7 +369221,7 @@ var ts; // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration checkFunctionOrMethodDeclaration(node); // method signatures already report "implementation not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.body) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } // Private named methods are only allowed in class declarations @@ -368614,7 +369274,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return n.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(n) && !!n.initializer; } @@ -368697,7 +369357,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { if (!(node.flags & 16777216 /* NodeFlags.Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* NodeFlags.HasImplicitReturn */)) { if (!(node.flags & 512 /* NodeFlags.HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -368707,20 +369367,20 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* NodeCheckFlags.TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* NodeCheckFlags.TypeChecked */; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128 /* ModifierFlags.Abstract */) !== (setterFlags & 128 /* ModifierFlags.Abstract */)) { + if ((getterFlags & 256 /* ModifierFlags.Abstract */) !== (setterFlags & 256 /* ModifierFlags.Abstract */)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -368737,7 +369397,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -368783,7 +369443,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -368799,7 +369459,7 @@ var ts; } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol) { - if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) { + if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) { addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName); } if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) { @@ -368841,7 +369501,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { + if (e.kind !== 199 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -368890,7 +369550,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) { - if (accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(objectType) & 1 /* MappedTypeModifiers.IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -368955,7 +369615,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -368965,7 +369625,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var declarations = ts.getDeclarationsOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { // Report an error on every conflicting declaration. var name = symbolToString(symbol); @@ -369006,10 +369666,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185 /* SyntaxKind.OptionalType */) { + if (node.type.kind === 187 /* SyntaxKind.OptionalType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186 /* SyntaxKind.RestType */) { + if (node.type.kind === 188 /* SyntaxKind.RestType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -369022,9 +369682,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */ && - n.parent.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - n.parent.kind !== 226 /* SyntaxKind.ClassExpression */ && + if (n.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */ && + n.parent.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + n.parent.kind !== 228 /* SyntaxKind.ClassExpression */ && n.flags & 16777216 /* NodeFlags.Ambient */) { if (!(flags & 2 /* ModifierFlags.Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { // It is nested in an ambient context, which means it is automatically exported @@ -369064,7 +369724,7 @@ var ts; else if (deviation & (8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128 /* ModifierFlags.Abstract */) { + else if (deviation & 256 /* ModifierFlags.Abstract */) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -369081,7 +369741,7 @@ var ts; }); } } - var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 128 /* ModifierFlags.Abstract */; + var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 256 /* ModifierFlags.Abstract */; var someNodeFlags = 0 /* ModifierFlags.None */; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -369120,7 +369780,7 @@ var ts; // Both are literal property names that are the same. ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */) && + var reportError = (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */) && ts.isStatic(node) !== ts.isStatic(subsequentNode); // we can get here in two cases // 1. mixed static and instance class members @@ -369145,7 +369805,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -369162,7 +369822,7 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216 /* NodeFlags.Ambient */; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -369173,10 +369833,10 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if ((node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { + if ((node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */ || node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */ || node.kind === 173 /* SyntaxKind.Constructor */) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -369221,12 +369881,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* SymbolFlags.Function */ && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257 /* SyntaxKind.ClassDeclaration */; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260 /* SyntaxKind.ClassDeclaration */; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + var diagnostic = declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ + : declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -369236,7 +369896,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -369282,9 +369942,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */); if (effectiveDeclarationFlags & 1 /* ModifierFlags.Export */) { - if (effectiveDeclarationFlags & 512 /* ModifierFlags.Default */) { + if (effectiveDeclarationFlags & 1024 /* ModifierFlags.Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -369317,26 +369977,26 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // A jsdoc typedef and callback are, by definition, type aliases. // falls through - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return 2 /* DeclarationSpaces.ExportType */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* ModuleInstanceState.NonInstantiated */ ? 4 /* DeclarationSpaces.ExportNamespace */ | 1 /* DeclarationSpaces.ExportValue */ : 4 /* DeclarationSpaces.ExportNamespace */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */ | 4 /* DeclarationSpaces.ExportNamespace */; - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; // Export assigned entity name expressions act as aliases and should fall through, otherwise they export values @@ -369346,19 +370006,19 @@ var ts; d = expression; // The below options all declare an Alias, which is allowed to merge with other values within the importing module. // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: var result_12 = 0 /* DeclarationSpaces.None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 case 79 /* SyntaxKind.Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` @@ -369402,7 +370062,7 @@ var ts; return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0]; } // primitives with a `{ then() }` won't be unwrapped/adopted. - if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { return undefined; } var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217 @@ -369469,7 +370129,7 @@ var ts; * Determines whether a type is an object with a callable `then` member. */ function isThenableType(type) { - if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { // primitive types cannot be considered "thenable" since they are not objects. return false; } @@ -369503,7 +370163,7 @@ var ts; // We only need `Awaited` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`, // or is promise-like. if (baseConstraint ? - baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) : + baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) : maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) { return true; } @@ -369771,20 +370431,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -369843,15 +370503,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; } } @@ -369860,13 +370520,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 197 /* SyntaxKind.NamedTupleMember */) { + while (typeNode.kind === 193 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 199 /* SyntaxKind.NamedTupleMember */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 196 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 198 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -369912,14 +370572,14 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8 /* ExternalEmitHelpers.Decorate */); - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* ExternalEmitHelpers.Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* ExternalEmitHelpers.Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -369928,23 +370588,23 @@ var ts; } } break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - var otherKind = node.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + var otherKind = node.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -370046,7 +370706,7 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; default: return undefined; @@ -370060,7 +370720,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -370086,7 +370746,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 /* SyntaxKind.MethodSignature */ ? undefined : node.body; + var body = node.kind === 170 /* SyntaxKind.MethodSignature */ ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -370132,42 +370792,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305 /* SyntaxKind.SourceFile */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 308 /* SyntaxKind.SourceFile */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.body) { // Don't report unused parameters in overloads checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -370177,7 +370837,7 @@ var ts; } function errorUnusedLocal(declaration, name, addDiagnostic) { var node = ts.getNameOfDeclaration(declaration) || declaration; - var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; + var message = ts.isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name)); } function isIdentifierThatStartsWithUnderscore(node) { @@ -370187,11 +370847,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { // Already would have reported an error on the getter. break; } @@ -370202,7 +370862,7 @@ var ts; addDiagnostic(member, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8 /* ModifierFlags.Private */)) { @@ -370210,9 +370870,9 @@ var ts; } } break; - case 176 /* SyntaxKind.IndexSignature */: - case 234 /* SyntaxKind.SemicolonClassElement */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 237 /* SyntaxKind.SemicolonClassElement */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Can't be private break; default: @@ -370240,7 +370900,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -370346,7 +371006,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* UnusedKind.Local */, unuseds.length === 1 @@ -370364,7 +371024,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* UnusedKind.Parameter */ : 0 /* UnusedKind.Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -370385,7 +371045,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0 /* UnusedKind.Local */, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -370415,22 +371075,22 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return ts.idText(name); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */ || node.kind === 270 /* SyntaxKind.ImportSpecifier */ || node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 270 /* SyntaxKind.ImportClause */ || node.kind === 273 /* SyntaxKind.ImportSpecifier */ || node.kind === 271 /* SyntaxKind.NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 267 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 268 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 270 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 271 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 235 /* SyntaxKind.Block */) { + if (node.kind === 238 /* SyntaxKind.Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -370465,13 +371125,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */ || - node.kind === 168 /* SyntaxKind.MethodSignature */ || - node.kind === 172 /* SyntaxKind.GetAccessor */ || - node.kind === 173 /* SyntaxKind.SetAccessor */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */ || + node.kind === 170 /* SyntaxKind.MethodSignature */ || + node.kind === 174 /* SyntaxKind.GetAccessor */ || + node.kind === 175 /* SyntaxKind.SetAccessor */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */) { // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified return false; } @@ -370537,7 +371197,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -370552,7 +371212,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -370652,7 +371312,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -370664,17 +371324,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* NodeFlags.BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); - var container = varDeclList.parent.kind === 237 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); + var container = varDeclList.parent.kind === 240 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || - container.kind === 262 /* SyntaxKind.ModuleBlock */ || - container.kind === 261 /* SyntaxKind.ModuleDeclaration */ || - container.kind === 305 /* SyntaxKind.SourceFile */); + (container.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || + container.kind === 265 /* SyntaxKind.ModuleBlock */ || + container.kind === 264 /* SyntaxKind.ModuleDeclaration */ || + container.kind === 308 /* SyntaxKind.SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -370705,7 +371365,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -370727,7 +371387,7 @@ var ts; checkExternalEmitHelpers(node, 4 /* ExternalEmitHelpers.Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access @@ -370749,7 +371409,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* ExternalEmitHelpers.Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -370761,7 +371421,7 @@ var ts; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { // Don't validate for-in initializer as it is already an error @@ -370789,7 +371449,7 @@ var ts; } // For a commonjs `const x = require`, validate the alias and exit var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { + if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -370803,7 +371463,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); } } @@ -370829,10 +371489,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -370840,7 +371500,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 166 /* SyntaxKind.PropertySignature */ + var message = nextDeclaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 168 /* SyntaxKind.PropertySignature */ ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -370850,8 +371510,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 /* SyntaxKind.Parameter */ && right.kind === 254 /* SyntaxKind.VariableDeclaration */) || - (left.kind === 254 /* SyntaxKind.VariableDeclaration */ && right.kind === 164 /* SyntaxKind.Parameter */)) { + if ((left.kind === 166 /* SyntaxKind.Parameter */ && right.kind === 257 /* SyntaxKind.VariableDeclaration */) || + (left.kind === 257 /* SyntaxKind.VariableDeclaration */ && right.kind === 166 /* SyntaxKind.Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -370860,8 +371520,8 @@ var ts; } var interestingFlags = 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | - 256 /* ModifierFlags.Async */ | - 128 /* ModifierFlags.Abstract */ | + 512 /* ModifierFlags.Async */ | + 256 /* ModifierFlags.Abstract */ | 64 /* ModifierFlags.Readonly */ | 32 /* ModifierFlags.Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -370890,15 +371550,15 @@ var ts; function checkIfStatement(node) { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236 /* SyntaxKind.EmptyStatement */) { + if (node.thenStatement.kind === 239 /* SyntaxKind.EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -370913,7 +371573,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast) return; @@ -371027,12 +371687,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -371072,14 +371732,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); // There may be a destructuring assignment on the left side - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -371111,7 +371771,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -371125,7 +371785,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -371607,7 +372267,16 @@ var ts; var message = allowAsyncIterables ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator; - return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type)); + var suggestAwait = + // for (const x of Promise<...>) or [...Promise<...>] + !!getAwaitedTypeOfPromise(type) + // for (const x of AsyncIterable<...>) + || (!allowAsyncIterables && + ts.isForOfStatement(errorNode.parent) && + errorNode.parent.expression === errorNode && + getGlobalAsyncIterableType(/** reportErrors */ false) !== emptyGenericType && + isTypeAssignableTo(type, getGlobalAsyncIterableType(/** reportErrors */ false))); + return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type)); } /** * Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type. @@ -371925,12 +372594,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* TypeFlags.Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173 /* SyntaxKind.SetAccessor */) { + if (container.kind === 175 /* SyntaxKind.SetAccessor */) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -371948,7 +372617,7 @@ var ts; } } } - else if (container.kind !== 171 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -371977,7 +372646,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -371986,7 +372655,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -372023,7 +372692,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -372118,9 +372787,9 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; - var propDeclaration = declaration && declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || - name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || + name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; var _loop_30 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -372145,7 +372814,7 @@ var ts; function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; var _loop_31 = function (info) { if (info === checkInfo) @@ -372217,7 +372886,7 @@ var ts; } else { ts.forEach(jsdocParameters, function (_a, index) { - var name = _a.name; + var name = _a.name, isNameFirst = _a.isNameFirst; if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) { return; } @@ -372227,7 +372896,9 @@ var ts; } } else { - errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + if (!isNameFirst) { + errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + } } }); } @@ -372265,7 +372936,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */) { var type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeFlags.TypeParameter */) { for (var i = index; i < typeParameters.length; i++) { @@ -372355,7 +373026,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -372422,7 +373093,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); - if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -372657,7 +373328,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 /* SyntaxKind.ClassDeclaration */ || d.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return d.kind === 260 /* SyntaxKind.ClassDeclaration */ || d.kind === 261 /* SyntaxKind.InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -372698,7 +373369,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128 /* ModifierFlags.Abstract */))) { + if (baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256 /* ModifierFlags.Abstract */))) { // Searches other base types for a declaration that would satisfy the inherited abstract member. // (The class may have more than one base type via declaration merging with an interface with the // same name.) @@ -372712,7 +373383,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226 /* SyntaxKind.ClassExpression */) { + if (derivedClassDecl.kind === 228 /* SyntaxKind.ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -372747,11 +373418,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432 /* SymbolFlags.Transient */) - && !(baseDeclarationFlags & 128 /* ModifierFlags.Abstract */) - && !(derivedDeclarationFlags & 128 /* ModifierFlags.Abstract */) + && !(baseDeclarationFlags & 256 /* ModifierFlags.Abstract */) + && !(derivedDeclarationFlags & 256 /* ModifierFlags.Abstract */) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* NodeFlags.Ambient */); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -372794,7 +373465,7 @@ var ts; } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -372876,7 +373547,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -372919,7 +373590,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -372952,7 +373623,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138 /* SyntaxKind.IntrinsicKeyword */) { + if (node.type.kind === 139 /* SyntaxKind.IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -373038,7 +373709,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -373048,7 +373719,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -373077,7 +373748,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return evaluate(expr.expression); case 79 /* SyntaxKind.Identifier */: var identifier = expr; @@ -373085,13 +373756,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384 /* SymbolFlags.Enum */) { var name = void 0; - if (expr.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (expr.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { name = expr.name.escapedText; } else { @@ -373128,8 +373799,8 @@ var ts; return false; } return node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 207 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 209 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -373163,7 +373834,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -373192,8 +373863,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || - (declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || + (declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { return declaration; } @@ -373264,7 +373935,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 257 /* SyntaxKind.ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 260 /* SyntaxKind.ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* NodeCheckFlags.LexicalModuleMergesWithClass */; @@ -373307,56 +373978,43 @@ var ts; } } function checkModuleAugmentationElement(node, isGlobalAugmentation) { - var _a; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement - for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { - var decl = _b[_i]; + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203 /* SyntaxKind.BindingElement */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { - for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { - var el = _d[_c]; + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { + var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } - var symbol = getSymbolOfNode(node); - if (symbol) { - // module augmentations cannot introduce new names on the top level scope of the module - // this is done it two steps - // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error - // 2. main check - report error if value declaration of the parent symbol is module augmentation) - var reportError = !(symbol.flags & 33554432 /* SymbolFlags.Transient */); - if (!reportError) { - // symbol should not originate in augmentation - reportError = !!((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.declarations) && ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); - } - } break; } } @@ -373364,12 +374022,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -373389,9 +374047,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 /* SyntaxKind.ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 /* SyntaxKind.ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -373438,8 +374096,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274 /* SyntaxKind.NamespaceExport */); - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */) { + ts.Debug.assert(node.kind !== 277 /* SyntaxKind.NamespaceExport */); + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -373450,7 +374108,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254 /* SyntaxKind.VariableDeclaration */); + ts.Debug.assert(node.kind !== 257 /* SyntaxKind.VariableDeclaration */); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -373458,11 +374116,12 @@ var ts; } return; } + var targetFlags = getAllSymbolFlags(target); var excludedMeanings = (symbol.flags & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */) ? 111551 /* SymbolFlags.Value */ : 0) | (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) | (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0); - if (target.flags & excludedMeanings) { - var message = node.kind === 275 /* SyntaxKind.ExportSpecifier */ ? + if (targetFlags & excludedMeanings) { + var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -373471,26 +374130,26 @@ var ts; && !ts.isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol); - var isType = !(target.flags & 111551 /* SymbolFlags.Value */); + var isType = !(targetFlags & 111551 /* SymbolFlags.Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { + if (isType && node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // Don't allow re-exporting an export that will be elided when `--isolatedModules` is set. // The exception is that `import type { A } from './a'; export { A }` is allowed // because single-file analysis can determine that the export should be dropped. @@ -373549,7 +374208,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 /* SyntaxKind.ImportSpecifier */ && + if (node.kind === 273 /* SyntaxKind.ImportSpecifier */ && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -373599,7 +374258,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { // import * as ns from "foo"; @@ -373628,17 +374287,18 @@ var ts; if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */) { + if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { - if (target.flags & 111551 /* SymbolFlags.Value */) { + var targetFlags = getAllSymbolFlags(target); + if (targetFlags & 111551 /* SymbolFlags.Value */) { // Target is a value symbol, check that it is not hidden by a local declaration with the same name var moduleName = ts.getFirstIdentifier(node.moduleReference); if (!(resolveEntityName(moduleName, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */).flags & 1920 /* SymbolFlags.Namespace */)) { error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); } } - if (target.flags & 788968 /* SymbolFlags.Type */) { + if (targetFlags & 788968 /* SymbolFlags.Type */) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); } } @@ -373671,10 +374331,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* NodeFlags.Ambient */; - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -373709,7 +374369,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273 /* SyntaxKind.NamedExports */) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276 /* SyntaxKind.NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -373719,7 +374379,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 /* SyntaxKind.SourceFile */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 308 /* SyntaxKind.SourceFile */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -373777,7 +374437,7 @@ var ts; markExportAsReferenced(node); } var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol); - if (!target || target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (!target || getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) { checkExpressionCached(node.propertyName || node.name); } } @@ -373799,8 +374459,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -373824,7 +374484,7 @@ var ts; markAliasReferenced(sym, id); // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`) var target = sym.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(sym) : sym; - if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) { // However if it is a value, we need to check it's being used correctly checkExpressionCached(node.expression); } @@ -373932,181 +374592,181 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 /* SyntaxKind.FirstStatement */ && kind <= 253 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 /* SyntaxKind.FirstStatement */ && kind <= 256 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return checkTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return checkParameter(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return checkPropertyDeclaration(node); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checkPropertySignature(node); - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return checkSignatureDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return checkMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return checkConstructorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return checkAccessorDeclaration(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return checkTypeReferenceNode(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return checkTypePredicate(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return checkTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return checkTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return checkArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return checkTupleType(node); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return checkUnionOrIntersectionType(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: return checkSourceElement(node.type); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return checkThisType(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return checkTypeOperator(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return checkConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return checkInferType(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return checkTemplateLiteralType(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return checkImportType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return checkNamedTupleMember(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return checkJSDocTypeTag(node); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: + case 327 /* SyntaxKind.JSDocLink */: + case 328 /* SyntaxKind.JSDocLinkCode */: + case 329 /* SyntaxKind.JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return checkJSDocParameterTag(node); - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: checkJSDocFunctionType(node); // falls through - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return checkSourceElement(node.type); - case 333 /* SyntaxKind.JSDocPublicTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return checkIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return checkMappedType(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return checkFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return checkBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return checkVariableStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return checkExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return checkIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return checkDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return checkWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return checkForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return checkForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: return checkBreakOrContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return checkReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return checkSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return checkThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return checkTryStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checkVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return checkBindingElement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return checkClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return checkEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return checkModuleDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return checkImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return checkExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return checkExportAssignment(node); - case 236 /* SyntaxKind.EmptyStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -374213,36 +374873,36 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: // These node kinds are deferred checked when overload resolution fails // To save on work, we ensure the arguments are checked just once, in // a deferred way resolveUntypedCall(node); break; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: checkAccessorDeclaration(node); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: checkClassExpressionDeferred(node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: checkTypeParameterDeferred(node); break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: checkJsxElementDeferred(node); break; } @@ -374415,17 +375075,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalModule(location)) break; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* SymbolFlags.ModuleMember */); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* SymbolFlags.EnumMember */); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -374433,8 +375093,8 @@ var ts; // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration. // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -374443,7 +375103,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* SymbolFlags.Type */); } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -374487,7 +375147,7 @@ var ts; if (meaning) { source.forEach(function (symbol) { // Similar condition as in `resolveNameHelper` - if (!ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 274 /* SyntaxKind.NamespaceExport */)) { + if (!ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 277 /* SyntaxKind.NamespaceExport */)) { copySymbol(symbol, meaning); } }); @@ -374496,41 +375156,21 @@ var ts; } function isTypeDeclarationName(name) { return name.kind === 79 /* SyntaxKind.Identifier */ && - isTypeDeclaration(name.parent) && + ts.isTypeDeclaration(name.parent) && ts.getNameOfDeclaration(name.parent) === name; } - function isTypeDeclaration(node) { - switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return true; - case 267 /* SyntaxKind.ImportClause */: - return node.isTypeOnly; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return node.parent.parent.isTypeOnly; - default: - return false; - } - } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 178 /* SyntaxKind.TypeReference */; + return node.parent.kind === 180 /* SyntaxKind.TypeReference */; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -374558,13 +375198,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (nodeOnRightSide.parent.kind === 163 /* SyntaxKind.QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -374590,7 +375230,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 /* SyntaxKind.ImportType */ && parent.qualifier === node) { + if (parent && parent.kind === 202 /* SyntaxKind.ImportType */ && parent.qualifier === node) { return parent; } return undefined; @@ -374600,7 +375240,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + name.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && name.parent === name.parent.parent.left) { // Check if this is a special property assignment if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { @@ -374610,7 +375250,7 @@ var ts; } } } - if (name.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression var success = resolveEntityName(name, /*all meanings*/ 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*ignoreErrors*/ true); @@ -374620,7 +375260,7 @@ var ts; } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(name, 265 /* SyntaxKind.ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(name, 268 /* SyntaxKind.ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, /*dontResolveAlias*/ true); } @@ -374638,7 +375278,7 @@ var ts; if (isHeritageClauseElementIdentifier(name)) { var meaning = 0 /* SymbolFlags.None */; // In an interface or class, we're definitely interested in a type. - if (name.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (name.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { meaning = 788968 /* SymbolFlags.Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { @@ -374654,10 +375294,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340 /* SyntaxKind.JSDocParameterTag */) { + if (name.parent.kind === 343 /* SyntaxKind.JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 344 /* SyntaxKind.JSDocTemplateTag */) { + if (name.parent.kind === 165 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 347 /* SyntaxKind.JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJSFile(name)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -374681,18 +375321,53 @@ var ts; return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 161 /* SyntaxKind.QualifiedName */) { + else if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 163 /* SyntaxKind.QualifiedName */) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* CheckMode.Normal */); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index" /* InternalSymbolName.Index */); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072 /* SymbolFlags.Signature */, "__index" /* InternalSymbolName.Index */); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0 /* CheckMode.Normal */); @@ -374707,11 +375382,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; + var meaning = name.parent.kind === 180 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; var symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177 /* SyntaxKind.TypePredicate */) { + if (name.parent.kind === 179 /* SyntaxKind.TypePredicate */) { return resolveEntityName(name, /*meaning*/ 1 /* SymbolFlags.FunctionScopedVariable */); } return undefined; @@ -374745,7 +375420,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -374768,8 +375443,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 /* SyntaxKind.BindingElement */ && - grandParent.kind === 201 /* SyntaxKind.ObjectBindingPattern */ && + else if (parent.kind === 205 /* SyntaxKind.BindingElement */ && + grandParent.kind === 203 /* SyntaxKind.ObjectBindingPattern */ && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -374796,8 +375471,8 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -374814,14 +375489,14 @@ var ts; return checkExpression(node).symbol; } // falls through - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return getTypeFromThisTypeNode(node).symbol; case 106 /* SyntaxKind.SuperKeyword */: return checkExpression(node).symbol; - case 134 /* SyntaxKind.ConstructorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171 /* SyntaxKind.Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 173 /* SyntaxKind.Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -374832,7 +375507,7 @@ var ts; // 3). Dynamic import call or require in javascript // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 272 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 275 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -374854,14 +375529,14 @@ var ts; case 38 /* SyntaxKind.EqualsGreaterThanToken */: case 84 /* SyntaxKind.ClassKeyword */: return getSymbolOfNode(node.parent); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93 /* SyntaxKind.ExportKeyword */: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100 /* SyntaxKind.ImportKeyword */: case 103 /* SyntaxKind.NewKeyword */: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return checkExpression(node).symbol; default: return undefined; @@ -374877,7 +375552,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (location && location.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* SymbolFlags.Value */ | 2097152 /* SymbolFlags.Alias */); } return undefined; @@ -374916,7 +375591,7 @@ var ts; var baseType = ts.firstOrUndefined(getBaseTypes(classType)); return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType; } - if (isTypeDeclaration(node)) { + if (ts.isTypeDeclaration(node)) { // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); @@ -374959,23 +375634,23 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (expr.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expr.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (expr.parent.kind === 299 /* SyntaxKind.PropertyAssignment */) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -375023,7 +375698,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 10 /* SyntaxKind.StringLiteral */: return getStringLiteralType(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* TypeFlags.ESSymbolLike */) ? nameType : stringType; default: @@ -375111,7 +375786,7 @@ var ts; return symbolLinks.exportsSomeValue; function isValue(s) { s = resolveSymbol(s); - return s && !!(s.flags & 111551 /* SymbolFlags.Value */); + return s && !!(getAllSymbolFlags(s) & 111551 /* SymbolFlags.Value */); } } function isNameOfModuleOrEnumDeclaration(node) { @@ -375141,7 +375816,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305 /* SyntaxKind.SourceFile */) { + if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308 /* SyntaxKind.SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -375161,10 +375836,10 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); + var symbol = getReferencedValueOrAliasSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol - if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) { return getDeclarationOfAliasSymbol(symbol); } } @@ -375173,7 +375848,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292 /* SyntaxKind.CatchClause */; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295 /* SyntaxKind.CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* SymbolFlags.BlockScoped */ && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -375204,7 +375879,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 235 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 238 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -375245,19 +375920,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: var symbol = getSymbolOfNode(node); - return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272 /* SyntaxKind.ExportDeclaration */: + return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */); + case 275 /* SyntaxKind.ExportDeclaration */: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return node.expression && node.expression.kind === 79 /* SyntaxKind.Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -375266,7 +375941,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -375274,6 +375949,7 @@ var ts; return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { + var _a; if (!symbol) { return false; } @@ -375283,7 +375959,7 @@ var ts; } // const enums and modules that contain only const enums are not considered values from the emit perspective // unless 'preserveConstEnums' option is set to true - return !!(target.flags & 111551 /* SymbolFlags.Value */) && + return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551 /* SymbolFlags.Value */) && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { @@ -375298,7 +375974,7 @@ var ts; } var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217 if (target && ts.getEffectiveModifierFlags(node) & 1 /* ModifierFlags.Export */ && - target.flags & 111551 /* SymbolFlags.Value */ && + getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */ && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) { // An `export import ... =` of a value symbol is always considered referenced return true; @@ -375376,15 +376052,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299 /* SyntaxKind.EnumMember */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 302 /* SyntaxKind.EnumMember */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299 /* SyntaxKind.EnumMember */) { + if (node.kind === 302 /* SyntaxKind.EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -375477,7 +376153,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); @@ -375496,7 +376172,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -375504,7 +376180,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -375528,6 +376204,25 @@ var ts; } return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); } + /** + * Get either a value-meaning symbol or an alias symbol. + * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol, + * we call `resolveName` to find a symbol. + * This is because when caching the resolved symbol, we only consider value symbols, but here + * we want to also get an alias symbol if one exists. + */ + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, + /*nodeNotFoundMessage*/ undefined, + /*nameArg*/ undefined, + /*isUse*/ true, + /*excludeGlobals*/ undefined, + /*getSpellingSuggestions*/ undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -375661,12 +376356,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217 - var otherKind = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? 172 /* SyntaxKind.GetAccessor */ : 173 /* SyntaxKind.SetAccessor */; + var otherKind = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? 174 /* SyntaxKind.GetAccessor */ : 175 /* SyntaxKind.SetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -375682,7 +376377,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -375719,7 +376414,7 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */; + return node.parent && node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */; } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -375732,12 +376427,12 @@ var ts; // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries var meaning; - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } else { meaning = 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */; - if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { + if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } } @@ -375786,7 +376481,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -375814,12 +376509,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217 if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305 /* SyntaxKind.SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 308 /* SyntaxKind.SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -376031,14 +376726,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -376057,26 +376752,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.kind === 166 /* SyntaxKind.PropertySignature */ || node.kind === 168 /* SyntaxKind.MethodSignature */) { + if (modifier.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.kind === 168 /* SyntaxKind.PropertySignature */ || node.kind === 170 /* SyntaxKind.MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 144 /* SyntaxKind.OutKeyword */) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 145 /* SyntaxKind.OutKeyword */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85 /* SyntaxKind.ConstKeyword */: - if (node.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85 /* SyntaxKind.ConstKeyword */)); } break; - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); @@ -376087,7 +376782,10 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384 /* ModifierFlags.Override */; @@ -376106,16 +376804,19 @@ var ts; else if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { if (modifier.kind === 121 /* SyntaxKind.PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -376135,16 +376836,19 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -376153,11 +376857,26 @@ var ts; flags |= 32 /* ModifierFlags.Static */; lastStatic = modifier; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64 /* ModifierFlags.Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2 /* ModifierFlags.Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128 /* ModifierFlags.Accessor */; + break; + case 146 /* SyntaxKind.ReadonlyKeyword */: if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */ && node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 164 /* SyntaxKind.Parameter */) { + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */ && node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 166 /* SyntaxKind.Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -376170,35 +376889,35 @@ var ts; else if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* ModifierFlags.Export */; break; case 88 /* SyntaxKind.DefaultKeyword */: - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1 /* ModifierFlags.Export */)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512 /* ModifierFlags.Default */; + flags |= 1024 /* ModifierFlags.Default */; break; - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -376207,10 +376926,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -376220,18 +376939,18 @@ var ts; lastDeclare = modifier; break; case 126 /* SyntaxKind.AbstractKeyword */: - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - node.kind !== 180 /* SyntaxKind.ConstructorType */) { - if (node.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - node.kind !== 172 /* SyntaxKind.GetAccessor */ && - node.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (node.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + node.kind !== 182 /* SyntaxKind.ConstructorType */) { + if (node.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + node.kind !== 174 /* SyntaxKind.GetAccessor */ && + node.kind !== 175 /* SyntaxKind.SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */))) { + if (!(node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* ModifierFlags.Static */) { @@ -376240,39 +376959,42 @@ var ts; if (flags & 8 /* ModifierFlags.Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 /* ModifierFlags.Async */ && lastAsync) { + if (flags & 512 /* ModifierFlags.Async */ && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80 /* SyntaxKind.PrivateIdentifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128 /* ModifierFlags.Abstract */; + flags |= 256 /* ModifierFlags.Abstract */; break; - case 131 /* SyntaxKind.AsyncKeyword */: - if (flags & 256 /* ModifierFlags.Async */) { + case 132 /* SyntaxKind.AsyncKeyword */: + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* ModifierFlags.Ambient */ || node.parent.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256 /* ModifierFlags.Async */; + flags |= 512 /* ModifierFlags.Async */; lastAsync = modifier; break; case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: var inOutFlag = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? 32768 /* ModifierFlags.In */ : 65536 /* ModifierFlags.Out */; var inOutText = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? "in" : "out"; - if (node.kind !== 163 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -376285,28 +377007,28 @@ var ts; break; } } - if (node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 173 /* SyntaxKind.Constructor */) { if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { + else if ((node.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -376324,47 +377046,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 179 /* SyntaxKind.FunctionType */: - case 276 /* SyntaxKind.MissingDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 279 /* SyntaxKind.MissingDeclaration */: return true; default: - if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return false; } switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 131 /* SyntaxKind.AsyncKeyword */); - case 257 /* SyntaxKind.ClassDeclaration */: - case 180 /* SyntaxKind.ConstructorType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 132 /* SyntaxKind.AsyncKeyword */); + case 260 /* SyntaxKind.ClassDeclaration */: + case 182 /* SyntaxKind.ConstructorType */: return nodeHasAnyModifiersExcept(node, 126 /* SyntaxKind.AbstractKeyword */); - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 85 /* SyntaxKind.ConstKeyword */); default: ts.Debug.assertNever(node); @@ -376382,10 +377104,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -376614,20 +377336,20 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { + if (computedPropertyName.expression.kind === 223 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.Debug.assert(node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */); if (node.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -376646,7 +377368,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (prop.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (inDestructuring) { // a rest property cannot be destructured any further var expression = ts.skipParentheses(prop.expression); @@ -376657,11 +377379,11 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); @@ -376673,7 +377395,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 169 /* SyntaxKind.MethodDeclaration */)) { + if (ts.isModifier(mod) && (mod.kind !== 132 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 171 /* SyntaxKind.MethodDeclaration */)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -376694,8 +377416,8 @@ var ts; // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; switch (prop.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); @@ -376704,13 +377426,13 @@ var ts; } currentKind = 4 /* DeclarationMeaning.PropertyAssignment */; break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: currentKind = 8 /* DeclarationMeaning.Method */; break; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: currentKind = 1 /* DeclarationMeaning.GetAccessor */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: currentKind = 2 /* DeclarationMeaning.SetAccessor */; break; default: @@ -376753,7 +377475,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (attr.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -376763,7 +377485,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 /* SyntaxKind.JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 291 /* SyntaxKind.JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -376798,7 +377520,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768 /* NodeFlags.AwaitContext */)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -376832,7 +377554,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171 /* SyntaxKind.Constructor */) { + if (func && func.kind !== 173 /* SyntaxKind.Constructor */) { ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* FunctionFlags.Async */) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -376849,7 +377571,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -376864,20 +377586,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -376887,22 +377609,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 182 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 184 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */)) { if (languageVersion < 1 /* ScriptTarget.ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (accessor.parent.kind === 184 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -376910,11 +377632,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -376936,17 +377658,17 @@ var ts; * A set accessor has one parameter or a `this` parameter and one more parameter. */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154 /* SyntaxKind.UniqueKeyword */) { - if (node.type.kind !== 151 /* SyntaxKind.SymbolKeyword */) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + if (node.operator === 156 /* SyntaxKind.UniqueKeyword */) { + if (node.type.kind !== 153 /* SyntaxKind.SymbolKeyword */) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -376956,7 +377678,7 @@ var ts; } } switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: var decl = parent; if (decl.name.kind !== 79 /* SyntaxKind.Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -376968,13 +377690,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (!ts.hasSyntacticModifier(parent, 64 /* ModifierFlags.Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -376983,9 +377705,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.type.kind !== 183 /* SyntaxKind.ArrayType */ && node.type.kind !== 184 /* SyntaxKind.TupleType */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + else if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.type.kind !== 185 /* SyntaxKind.ArrayType */ && node.type.kind !== 186 /* SyntaxKind.TupleType */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } } } @@ -376998,10 +377720,10 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */) { - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */) { + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131 /* SyntaxKind.AsyncKeyword */)) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132 /* SyntaxKind.AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -377030,14 +377752,14 @@ var ts; if (node.flags & 16777216 /* NodeFlags.Ambient */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !node.body) { + else if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) { + else if (node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -377048,11 +377770,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 245 /* SyntaxKind.ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 248 /* SyntaxKind.ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -377060,8 +377782,8 @@ var ts; return false; } break; - case 249 /* SyntaxKind.SwitchStatement */: - if (node.kind === 246 /* SyntaxKind.BreakStatement */ && !node.label) { + case 252 /* SyntaxKind.SwitchStatement */: + if (node.kind === 249 /* SyntaxKind.BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -377076,13 +377798,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -377106,12 +377828,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 /* SyntaxKind.BigIntLiteral */ || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 9 /* SyntaxKind.BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { @@ -377139,7 +377861,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 247 /* SyntaxKind.ForOfStatement */) { if (node.flags & 16777216 /* NodeFlags.Ambient */) { checkAmbientInitializer(node); } @@ -377152,7 +377874,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -377219,15 +377941,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return false; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -377321,8 +378043,14 @@ var ts; if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -377368,14 +378096,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */)) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -377383,7 +378111,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237 /* SyntaxKind.VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 240 /* SyntaxKind.VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -377406,7 +378134,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 235 /* SyntaxKind.Block */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 238 /* SyntaxKind.Block */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { var links_2 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_2.hasReportedStatementInAmbientContext) { @@ -377428,10 +378156,10 @@ var ts; if (languageVersion >= 1 /* ScriptTarget.ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196 /* SyntaxKind.LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 198 /* SyntaxKind.LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299 /* SyntaxKind.EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 302 /* SyntaxKind.EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -377503,7 +378231,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269 /* SyntaxKind.NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272 /* SyntaxKind.NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -377511,7 +378239,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 /* SyntaxKind.ImportSpecifier */ + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 /* SyntaxKind.ImportSpecifier */ ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -377634,14 +378362,14 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 169 /* SyntaxKind.MethodDeclaration */) || + return (declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 171 /* SyntaxKind.MethodDeclaration */) || !!declaration.body; } /** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */ function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -377677,6 +378405,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -377743,7 +378472,6 @@ var ts; return nodes; } ts.visitNodes = visitNodes; - /* @internal */ function visitArray(nodes, visitor, test, start, count) { if (nodes === undefined) { return nodes; @@ -377891,12 +378619,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - /** - * Visits an iteration body, adding any block-scoped variables required by the transformation. - */ - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -377915,456 +378641,446 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */) || kind === 192 /* SyntaxKind.ThisType */) { - return node; - } - var factory = context.factory; - switch (kind) { - // Names - case 79 /* SyntaxKind.Identifier */: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161 /* SyntaxKind.QualifiedName */: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162 /* SyntaxKind.ComputedPropertyName */: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Signature elements - case 163 /* SyntaxKind.TypeParameter */: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164 /* SyntaxKind.Parameter */: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165 /* SyntaxKind.Decorator */: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Type elements - case 166 /* SyntaxKind.PropertySignature */: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167 /* SyntaxKind.PropertyDeclaration */: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), - // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too - nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168 /* SyntaxKind.MethodSignature */: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169 /* SyntaxKind.MethodDeclaration */: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171 /* SyntaxKind.Constructor */: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172 /* SyntaxKind.GetAccessor */: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173 /* SyntaxKind.SetAccessor */: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174 /* SyntaxKind.CallSignature */: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175 /* SyntaxKind.ConstructSignature */: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176 /* SyntaxKind.IndexSignature */: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - // Types - case 177 /* SyntaxKind.TypePredicate */: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178 /* SyntaxKind.TypeReference */: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179 /* SyntaxKind.FunctionType */: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180 /* SyntaxKind.ConstructorType */: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181 /* SyntaxKind.TypeQuery */: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182 /* SyntaxKind.TypeLiteral */: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183 /* SyntaxKind.ArrayType */: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184 /* SyntaxKind.TupleType */: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185 /* SyntaxKind.OptionalType */: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186 /* SyntaxKind.RestType */: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187 /* SyntaxKind.UnionType */: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188 /* SyntaxKind.IntersectionType */: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189 /* SyntaxKind.ConditionalType */: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190 /* SyntaxKind.InferType */: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200 /* SyntaxKind.ImportType */: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197 /* SyntaxKind.NamedTupleMember */: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191 /* SyntaxKind.ParenthesizedType */: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193 /* SyntaxKind.TypeOperator */: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194 /* SyntaxKind.IndexedAccessType */: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195 /* SyntaxKind.MappedType */: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196 /* SyntaxKind.LiteralType */: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198 /* SyntaxKind.TemplateLiteralType */: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202 /* SyntaxKind.ArrayBindingPattern */: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203 /* SyntaxKind.BindingElement */: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Expression - case 204 /* SyntaxKind.ArrayLiteralExpression */: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206 /* SyntaxKind.PropertyAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207 /* SyntaxKind.ElementAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208 /* SyntaxKind.CallExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209 /* SyntaxKind.NewExpression */: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211 /* SyntaxKind.TypeAssertionExpression */: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212 /* SyntaxKind.ParenthesizedExpression */: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213 /* SyntaxKind.FunctionExpression */: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214 /* SyntaxKind.ArrowFunction */: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215 /* SyntaxKind.DeleteExpression */: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216 /* SyntaxKind.TypeOfExpression */: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217 /* SyntaxKind.VoidExpression */: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218 /* SyntaxKind.AwaitExpression */: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221 /* SyntaxKind.BinaryExpression */: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222 /* SyntaxKind.ConditionalExpression */: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223 /* SyntaxKind.TemplateExpression */: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224 /* SyntaxKind.YieldExpression */: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225 /* SyntaxKind.SpreadElement */: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226 /* SyntaxKind.ClassExpression */: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229 /* SyntaxKind.AsExpression */: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230 /* SyntaxKind.NonNullExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231 /* SyntaxKind.MetaProperty */: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Misc - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Element - case 235 /* SyntaxKind.Block */: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237 /* SyntaxKind.VariableStatement */: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238 /* SyntaxKind.ExpressionStatement */: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239 /* SyntaxKind.IfStatement */: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240 /* SyntaxKind.DoStatement */: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241 /* SyntaxKind.WhileStatement */: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242 /* SyntaxKind.ForStatement */: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243 /* SyntaxKind.ForInStatement */: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244 /* SyntaxKind.ForOfStatement */: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245 /* SyntaxKind.ContinueStatement */: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246 /* SyntaxKind.BreakStatement */: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247 /* SyntaxKind.ReturnStatement */: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248 /* SyntaxKind.WithStatement */: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249 /* SyntaxKind.SwitchStatement */: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250 /* SyntaxKind.LabeledStatement */: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251 /* SyntaxKind.ThrowStatement */: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252 /* SyntaxKind.TryStatement */: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254 /* SyntaxKind.VariableDeclaration */: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255 /* SyntaxKind.VariableDeclarationList */: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256 /* SyntaxKind.FunctionDeclaration */: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257 /* SyntaxKind.ClassDeclaration */: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258 /* SyntaxKind.InterfaceDeclaration */: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260 /* SyntaxKind.EnumDeclaration */: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261 /* SyntaxKind.ModuleDeclaration */: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262 /* SyntaxKind.ModuleBlock */: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263 /* SyntaxKind.CaseBlock */: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266 /* SyntaxKind.ImportDeclaration */: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293 /* SyntaxKind.AssertClause */: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294 /* SyntaxKind.AssertEntry */: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267 /* SyntaxKind.ImportClause */: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268 /* SyntaxKind.NamespaceImport */: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274 /* SyntaxKind.NamespaceExport */: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269 /* SyntaxKind.NamedImports */: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270 /* SyntaxKind.ImportSpecifier */: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271 /* SyntaxKind.ExportAssignment */: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272 /* SyntaxKind.ExportDeclaration */: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273 /* SyntaxKind.NamedExports */: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275 /* SyntaxKind.ExportSpecifier */: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // JSX - case 278 /* SyntaxKind.JsxElement */: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280 /* SyntaxKind.JsxOpeningElement */: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281 /* SyntaxKind.JsxClosingElement */: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282 /* SyntaxKind.JsxFragment */: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285 /* SyntaxKind.JsxAttribute */: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286 /* SyntaxKind.JsxAttributes */: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288 /* SyntaxKind.JsxExpression */: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Clauses - case 289 /* SyntaxKind.CaseClause */: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290 /* SyntaxKind.DefaultClause */: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291 /* SyntaxKind.HeritageClause */: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292 /* SyntaxKind.CatchClause */: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298 /* SyntaxKind.SpreadAssignment */: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Enum - case 299 /* SyntaxKind.EnumMember */: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - // Transformation nodes - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351 /* SyntaxKind.CommaListExpression */: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - // No need to visit nodes with no children. - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + // NOTE: Before you can add a new method to `visitEachChildTable`, you must first ensure the `Node` subtype you + // wish to add is defined in the `HasChildren` union in types.ts. + var visitEachChildTable = (_a = {}, + _a[79 /* SyntaxKind.Identifier */] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163 /* SyntaxKind.QualifiedName */] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Signature elements + _a[165 /* SyntaxKind.TypeParameter */] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166 /* SyntaxKind.Parameter */] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167 /* SyntaxKind.Decorator */] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Type elements + _a[168 /* SyntaxKind.PropertySignature */] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), + // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration + nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171 /* SyntaxKind.MethodDeclaration */] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173 /* SyntaxKind.Constructor */] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176 /* SyntaxKind.CallSignature */] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177 /* SyntaxKind.ConstructSignature */] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + // Types + _a[179 /* SyntaxKind.TypePredicate */] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180 /* SyntaxKind.TypeReference */] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181 /* SyntaxKind.FunctionType */] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185 /* SyntaxKind.ArrayType */] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186 /* SyntaxKind.TupleType */] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187 /* SyntaxKind.OptionalType */] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188 /* SyntaxKind.RestType */] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189 /* SyntaxKind.UnionType */] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190 /* SyntaxKind.IntersectionType */] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191 /* SyntaxKind.ConditionalType */] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192 /* SyntaxKind.InferType */] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202 /* SyntaxKind.ImportType */] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195 /* SyntaxKind.TypeOperator */] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196 /* SyntaxKind.IndexedAccessType */] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197 /* SyntaxKind.MappedType */] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198 /* SyntaxKind.LiteralType */] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Binding patterns + _a[203 /* SyntaxKind.ObjectBindingPattern */] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205 /* SyntaxKind.BindingElement */] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Expression + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210 /* SyntaxKind.CallExpression */] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211 /* SyntaxKind.NewExpression */] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228 /* SyntaxKind.ClassExpression */] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231 /* SyntaxKind.AsExpression */] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Misc + _a[236 /* SyntaxKind.TemplateSpan */] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Element + _a[238 /* SyntaxKind.Block */] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242 /* SyntaxKind.IfStatement */] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243 /* SyntaxKind.DoStatement */] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245 /* SyntaxKind.ForStatement */] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249 /* SyntaxKind.BreakStatement */] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250 /* SyntaxKind.ReturnStatement */] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251 /* SyntaxKind.WithStatement */] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255 /* SyntaxKind.TryStatement */] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265 /* SyntaxKind.ModuleBlock */] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296 /* SyntaxKind.AssertClause */] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270 /* SyntaxKind.ImportClause */] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272 /* SyntaxKind.NamedImports */] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274 /* SyntaxKind.ExportAssignment */] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275 /* SyntaxKind.ExportDeclaration */] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276 /* SyntaxKind.NamedExports */] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278 /* SyntaxKind.ExportSpecifier */] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Module references + _a[280 /* SyntaxKind.ExternalModuleReference */] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // JSX + _a[281 /* SyntaxKind.JsxElement */] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283 /* SyntaxKind.JsxOpeningElement */] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289 /* SyntaxKind.JsxAttributes */] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Clauses + _a[292 /* SyntaxKind.CaseClause */] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295 /* SyntaxKind.CatchClause */] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + // Property assignments + _a[299 /* SyntaxKind.PropertyAssignment */] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Enum + _a[302 /* SyntaxKind.EnumMember */] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Top-level nodes + _a[308 /* SyntaxKind.SourceFile */] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, /*start*/ undefined, /*ensureUseStrict*/ undefined, nodesVisitor)); + }, + // Transformation nodes + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); /** * Extracts the single node from a NodeArray. * @@ -378432,7 +379148,7 @@ var ts; exit(); return sourceIndex; } - /* eslint-disable boolean-trivia, no-null/no-null */ + /* eslint-disable local/boolean-trivia, no-null/no-null */ function setSourceContent(sourceIndex, content) { enter(); if (content !== null) { @@ -378445,7 +379161,7 @@ var ts; } exit(); } - /* eslint-enable boolean-trivia, no-null/no-null */ + /* eslint-enable local/boolean-trivia, no-null/no-null */ function addName(name) { enter(); if (!nameToNameIndexMap) @@ -379047,7 +379763,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -379098,7 +379814,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" @@ -379111,13 +379827,13 @@ var ts; hasImportDefault = true; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - if (node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + if (node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -379148,13 +379864,13 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -379162,9 +379878,9 @@ var ts; } } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default function() { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -379182,9 +379898,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default class { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -379362,7 +380078,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member) { - return member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + return member.kind === 169 /* SyntaxKind.PropertyDeclaration */ && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; @@ -379372,7 +380088,7 @@ var ts; * @param member The class element node. */ function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; /** @@ -379426,12 +380142,12 @@ var ts; */ function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return getAllDecoratorsOfAccessors(member, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -380092,8 +380808,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -380113,14 +380829,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -380169,15 +380885,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 262 /* SyntaxKind.ModuleBlock */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 265 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) { break; } @@ -380189,7 +380905,7 @@ var ts; // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - ts.Debug.assert(node.kind === 257 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)); + ts.Debug.assert(node.kind === 260 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)); } break; } @@ -380228,10 +380944,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -380252,13 +380968,13 @@ var ts; return node; } switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -380278,11 +380994,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ || - (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && - node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */)) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ || + (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && + node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -380306,27 +381022,27 @@ var ts; */ function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructor(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Property declarations are not TypeScript syntax, but they must be visited // for the decorator transformation. return visitPropertyDeclaration(node, parent); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.visitEachChild(node, visitor, context); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return node; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Index signatures are elided return; default: @@ -380338,17 +381054,17 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return visitor(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); @@ -380359,7 +381075,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958 /* ModifierFlags.TypeScriptModifier */) { + if (ts.modifierToFlag(node.kind) & 117086 /* ModifierFlags.TypeScriptModifier */) { return undefined; } else if (currentNamespace && node.kind === 93 /* SyntaxKind.ExportKeyword */) { @@ -380387,58 +381103,58 @@ var ts; case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: // TypeScript accessibility and readonly modifiers are elided // falls through - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 177 /* SyntaxKind.TypePredicate */: - case 163 /* SyntaxKind.TypeParameter */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 179 /* SyntaxKind.TypePredicate */: + case 165 /* SyntaxKind.TypeParameter */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 181 /* SyntaxKind.TypeQuery */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 189 /* SyntaxKind.ConditionalType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 192 /* SyntaxKind.ThisType */: - case 193 /* SyntaxKind.TypeOperator */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 196 /* SyntaxKind.LiteralType */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 183 /* SyntaxKind.TypeQuery */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 191 /* SyntaxKind.ConditionalType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 194 /* SyntaxKind.ThisType */: + case 195 /* SyntaxKind.TypeOperator */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 198 /* SyntaxKind.LiteralType */: // TypeScript type nodes are elided. // falls through - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // TypeScript index signatures are elided. return undefined; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return factory.createNotEmittedStatement(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return factory.createNotEmittedStatement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // This may be a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -380448,7 +381164,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // This may be a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -380458,34 +381174,34 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: // This may be a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // This may be a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -380495,40 +381211,42 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return visitSatisfiesExpression(node); + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: // node contains some other TypeScript syntax @@ -380798,10 +381516,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */; + return kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -380811,7 +381529,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -380822,12 +381540,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; } return false; @@ -380917,7 +381635,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -381025,7 +381743,7 @@ var ts; * @param node The declaration node. */ function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1 /* TransformFlags.ContainsTypeScript */)) { @@ -381167,6 +381885,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); @@ -381380,12 +382102,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentLexicalScope.kind === 305 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); + ], currentLexicalScope.kind === 308 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind === 263 /* SyntaxKind.EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -381510,7 +382232,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (node.body.kind === 265 /* SyntaxKind.ModuleBlock */) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -381557,13 +382279,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (!node.body || node.body.kind !== 262 /* SyntaxKind.ModuleBlock */) { + if (!node.body || node.body.kind !== 265 /* SyntaxKind.ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* EmitFlags.NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -381610,7 +382332,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (node.kind === 271 /* SyntaxKind.NamespaceImport */) { // Elide a namespace import if it is not referenced. return shouldEmitAliasDeclaration(node) ? node : undefined; } @@ -381768,7 +382490,7 @@ var ts; */ function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } /** * Gets a value indicating whether the node is the default export of an external module. @@ -381777,7 +382499,7 @@ var ts; */ function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), factory.getLocalName(node)); @@ -381822,16 +382544,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(79 /* SyntaxKind.Identifier */); - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(261 /* SyntaxKind.ModuleDeclaration */); + context.enableEmitNotification(264 /* SyntaxKind.ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261 /* SyntaxKind.ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260 /* SyntaxKind.EnumDeclaration */; + return ts.getOriginalNode(node).kind === 263 /* SyntaxKind.EnumDeclaration */; } /** * Hook for node emit. @@ -381892,9 +382614,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -381909,9 +382631,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 305 /* SyntaxKind.SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 261 /* SyntaxKind.ModuleDeclaration */) || - (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 260 /* SyntaxKind.EnumDeclaration */); + if (container && container.kind !== 308 /* SyntaxKind.SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 264 /* SyntaxKind.ModuleDeclaration */) || + (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 263 /* SyntaxKind.EnumDeclaration */); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), /*location*/ node); @@ -381950,9 +382672,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -382000,13 +382723,24 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + // Transform field initializers using Define semantics when `useDefineForClassFields: true` and target < ES2022. + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9 /* ScriptTarget.ES2022 */; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; + // We need to transform private members and class static blocks when target < ES2022. var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ScriptTarget.ES2022 */; + // We need to transform `accessor` fields when target < ESNext + var shouldTransformAutoAccessors = languageVersion < 99 /* ScriptTarget.ESNext */; // We need to transform `this` in a static initializer into a reference to the class - // when targeting < ES2022 since the assignment will be moved outside of the class body. + // when target < ES2022 since the assignment will be moved outside of the class body. var shouldTransformThisInStaticInitializers = languageVersion < 9 /* ScriptTarget.ES2022 */; - // We don't need to transform `super` property access when targeting ES5, ES3 because + // We don't need to transform `super` property access when target <= ES5 because // the es2015 transformation handles those. var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2 /* ScriptTarget.ES2015 */; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -382026,98 +382760,149 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ScriptTarget.ES2022 */) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) { - switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - return visitClassLike(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: - return visitVariableStatement(node); - case 80 /* SyntaxKind.PrivateIdentifier */: - return visitPrivateIdentifier(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) && + !(node.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */)) { + return node; } - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */ || - node.transformFlags & 134217728 /* TransformFlags.ContainsLexicalSuper */ && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: - return visitBinaryExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: - return visitCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitElementAccessExpression(node); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitExpressionStatement(node); - case 242 /* SyntaxKind.ForStatement */: - return visitForStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127 /* SyntaxKind.AccessorKeyword */: + return shouldTransformAutoAccessors ? undefined : node; + case 260 /* SyntaxKind.ClassDeclaration */: + return visitClassDeclaration(node); + case 228 /* SyntaxKind.ClassExpression */: + return visitClassExpression(node); + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + return visitClassStaticBlockDeclaration(node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return visitPropertyDeclaration(node); + case 240 /* SyntaxKind.VariableStatement */: + return visitVariableStatement(node); + case 80 /* SyntaxKind.PrivateIdentifier */: + return visitPrivateIdentifier(node); + case 208 /* SyntaxKind.PropertyAccessExpression */: + return visitPropertyAccessExpression(node); + case 209 /* SyntaxKind.ElementAccessExpression */: + return visitElementAccessExpression(node); + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ false); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ false); + case 210 /* SyntaxKind.CallExpression */: + return visitCallExpression(node); + case 241 /* SyntaxKind.ExpressionStatement */: + return visitExpressionStatement(node); + case 212 /* SyntaxKind.TaggedTemplateExpression */: + return visitTaggedTemplateExpression(node); + case 245 /* SyntaxKind.ForStatement */: + return visitForStatement(node); + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + // If we are descending into a new scope, clear the current static property or block + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } + /** + * Visits a node in an expression whose result is discarded. + */ function discardedValueVisitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } - function visitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ false); + switch (node.kind) { + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ true); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ true); + default: + return visitor(node); + } } + /** + * Visits a node in a {@link HeritageClause}. + */ function heritageClauseVisitor(node) { switch (node.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitExpressionWithTypeArguments(node); + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + /** + * Visits the assignment target of a destructuring assignment. + */ + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); } } + /** + * Visits a member of a class. + */ + function classElementVisitor(node) { + switch (node.kind) { + case 173 /* SyntaxKind.Constructor */: + return visitConstructorDeclaration(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitMethodOrAccessorDeclaration, node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitPropertyDeclaration, node); + case 164 /* SyntaxKind.ComputedPropertyName */: + return visitComputedPropertyName(node); + case 237 /* SyntaxKind.SemicolonClassElement */: + return node; + default: + return visitor(node); + } + } + /** + * Visits the results of an auto-accessor field transformation in a second pass. + */ + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169 /* SyntaxKind.PropertyDeclaration */: + return transformFieldInitializer(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } /** * If we visit a private name, this means it is an undeclared private name. * Replace it with an empty identifier to indicate a problem with the code, @@ -382133,17 +382918,15 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; + } /** * Visits `#id in expr` */ - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */); - var info = accessPrivateIdentifier(privId); + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); @@ -382151,31 +382934,6 @@ var ts; // Private name has not been declared. Subsequent transformers will handle this error return ts.visitEachChild(node, visitor, context); } - /** - * Visits the members of a class that has fields. - * - * @param node The node to visit. - */ - function classElementVisitor(node) { - switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - return visitMethodOrAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitComputedPropertyName(node); - case 234 /* SyntaxKind.SemicolonClassElement */: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -382185,15 +382943,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -382208,13 +382975,20 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, - /* typeParameters */ undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), - /* type */ undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, + /* typeParameters */ undefined, ts.visitParameterList(node.parameters, visitor, context), + /* type */ undefined, ts.visitFunctionBody(node.body, visitor, context)))); } // remove method declaration from class return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -382231,49 +383005,104 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - // static fields are left as is - return ts.visitEachChild(node, visitor, context); - } - // Initializer is elided as the field is initialized in transformConstructor. - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined); - } - // leave invalid code untransformed + function transformAutoAccessor(node) { + // transforms: + // accessor x = 1; + // into: + // #x = 1; + // get x() { return this.#x; } + // set x(value) { this.#x = value; } + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; - } + // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. + return info.isValid ? undefined : node; + } + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + // If we are transforming initializers using Set semantics we will elide the initializer as it will + // be moved to the constructor to preserve evaluation order next to public instance fields. We don't + // need to do this transformation for private static fields since public static fields can be + // transformed into `static {}` blocks. + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined); } - // Create a temporary variable to store a computed property name (if necessary). - // If it's not inlineable, then we emit an expression after the class which assigns - // the property name to the temporary variable. - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); - } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - // Set the comment range for the statement to an empty synthetic range - // and drop synthetic comments from the statement to avoid printing them twice. - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + var expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); + } + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + // Set the comment range for the statement to an empty synthetic range + // and drop synthetic comments from the statement to avoid printing them twice. + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function + // will in turn call `transformFieldInitializer` as needed. + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -382337,9 +383166,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || node.operator === 46 /* SyntaxKind.MinusMinusToken */) { + if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || + node.operator === 46 /* SyntaxKind.MinusMinusToken */) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -382428,7 +383259,9 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + // obj.#x() // Transform call expressions of private names to properly bind the `this` parameter. var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { @@ -382443,6 +383276,8 @@ var ts; ts.isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + // super.x() + // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` var invocation = factory.createFunctionCallCall(ts.visitNode(node.expression, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, ts.visitNodes(node.arguments, visitor, ts.isExpression)); ts.setOriginalNode(invocation, node); @@ -382452,7 +383287,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), @@ -382478,11 +383314,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -382492,9 +383325,12 @@ var ts; } function visitBinaryExpression(node, valueIsDiscarded) { if (ts.isDestructuringAssignment(node)) { + // ({ x: obj.#x } = ...) + // ({ x: super.x } = ...) + // ({ x: super[x] } = ...) var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -382502,7 +383338,9 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + // obj.#x = ... var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -382512,6 +383350,10 @@ var ts; ts.isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + // super.x = ... + // super[x] = ... + // super.x += ... + // super.x -= ... var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; if (facts & 1 /* ClassFacts.ClassWasDecorated */) { return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression)); @@ -382555,8 +383397,10 @@ var ts; } } } - if (node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + // #x in obj + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -382581,36 +383425,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - /** - * Set up the environment for a class. - */ - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -382624,7 +383438,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2 /* ClassFacts.NeedsClassConstructorReference */; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -382643,7 +383457,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0 /* ClassFacts.None */; if (facts & 4 /* ClassFacts.NeedsClassSuperReference */) { var temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); @@ -382653,7 +383467,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -382661,6 +383490,16 @@ var ts; if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { // If a class has private static fields, or a static field has a `this` or `super` reference, // then we need to allocate a temp variable to hold on to that reference. var pendingClassReferenceAssignment; @@ -382669,12 +383508,16 @@ var ts; getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } @@ -382682,25 +383525,23 @@ var ts; if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -382710,8 +383551,6 @@ var ts; // these statements after the class expression variable statement. var isDecoratedClassDeclaration = !!(facts & 1 /* ClassFacts.ClassWasDecorated */); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; var temp; function createClassTempVar() { @@ -382724,9 +383563,23 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` + // and not also transforming static blocks. + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -382738,12 +383591,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. @@ -382760,45 +383617,87 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } // ClassStaticBlockDeclaration for classes are transformed in `visitClassDeclaration` or `visitClassExpression`. return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { + // Declare private names if (shouldTransformPrivateElementsOrClassStaticBlocks) { - // Declare private names. for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + // Create a synthetic constructor if necessary + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(/*constructor*/ undefined, node); } + var prologue; + // If there are pending expressions create a class static block in which to evaluate them, but only if + // class static blocks are not also being transformed. This block will be injected at the top of the class + // to ensure that expressions from computed property names are evaluated before any other static + // initializers. + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */) { + // If there are `this` or `super` references from computed property names, shift the expression + // into an arrow function to be evaluated in the outer scope so that `this` and `super` are + // properly captured. + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction( + /*modifiers*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + /*equalsGreaterThanToken*/ undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, /*typeArguments*/ undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), /*location*/ node.members); + // If we created a synthetic constructor or class static block, add them to the visited members + // and return a new array. + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), /*location*/ node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -382807,35 +383706,38 @@ var ts; /*typeArguments*/ undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128 /* ModifierFlags.Abstract */)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - // If we are using define semantics and targeting ESNext or higher, - // then we don't need to transform any class properties. - return languageVersion < 9 /* ScriptTarget.ES2022 */; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, /*modifiers*/ undefined, parameters, body); } return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration( - /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -382887,8 +383789,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -382920,9 +383822,14 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), - /*location*/ constructor ? constructor.body.statements : node.members), - /*multiLine*/ true), + /*location*/ constructor ? constructor.body.statements : node.members), multiLine), /*location*/ constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { @@ -382958,9 +383865,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. // Drop the comments from expression to avoid printing them twice. @@ -382983,9 +383891,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -383012,9 +383921,11 @@ var ts; var _a; // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -383041,7 +383952,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256 /* ModifierFlags.Abstract */)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -383075,17 +383986,17 @@ var ts; // substitute `this` in a static field initializer context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); // these push a new lexical environment that is not the class lexical environment - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // these push a new lexical environment that is not the class lexical environment, except // when they have a computed property name - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(167 /* SyntaxKind.PropertyDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(169 /* SyntaxKind.PropertyDeclaration */); // class lexical environments are restored when entering a computed property name - context.enableEmitNotification(162 /* SyntaxKind.ComputedPropertyName */); + context.enableEmitNotification(164 /* SyntaxKind.ComputedPropertyName */); } } /** @@ -383124,13 +384035,13 @@ var ts; } } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144 /* EmitFlags.AsyncFunctionBody */) { break; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -383140,10 +384051,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -383153,7 +384064,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162 /* SyntaxKind.ComputedPropertyName */: { + case 164 /* SyntaxKind.ComputedPropertyName */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -383267,149 +384178,138 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isMethodDeclaration(node)) { + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, + isValid: isValid, + }); + } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { kind: "f" /* PrivateIdentifierKind.Field */, brandCheckIdentifier: weakMapName, - isStatic: false, variableName: undefined, + isStatic: false, isValid: isValid, }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), /*typeArguments*/ undefined, []))); } - else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m" /* PrivateIdentifierKind.Method */, + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + } + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16 /* GeneratedIdentifierFlags.Optimistic */); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 /* GeneratedIdentifierFlags.Optimistic */ | 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16 /* GeneratedIdentifierFlags.Optimistic */, prefix, suffix) : + factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */) { addBlockScopedVariable(identifier); } @@ -383418,13 +384318,33 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); + function createHoistedVariableForPrivateName(name, suffix) { + var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); } + /** + * Access an already defined {@link PrivateIdentifier} in the current {@link PrivateIdentifierEnvironment}. + * + * @seealso {@link addPrivateIdentifierToEnvironment} + */ function accessPrivateIdentifier(name) { - var _a; + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -383434,9 +384354,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -383493,7 +384415,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -383526,10 +384448,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -383575,7 +384497,31 @@ var ts; /*typeArguments*/ undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); /*@internal*/ @@ -383616,15 +384562,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: return serializeTypeNode(node.type); - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -383660,7 +384606,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (container && node.kind === 174 /* SyntaxKind.GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -383706,66 +384652,66 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return ts.factory.createVoidZero(); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return ts.factory.createIdentifier("Function"); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return ts.factory.createIdentifier("Array"); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return ts.factory.createIdentifier("Boolean"); - case 198 /* SyntaxKind.TemplateLiteralType */: - case 150 /* SyntaxKind.StringKeyword */: + case 200 /* SyntaxKind.TemplateLiteralType */: + case 152 /* SyntaxKind.StringKeyword */: return ts.factory.createIdentifier("String"); - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return ts.factory.createIdentifier("Object"); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return ts.factory.createIdentifier("Number"); - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ScriptTarget.ES2020 */); - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ScriptTarget.ES2015 */); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return serializeTypeReferenceNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ true); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ false); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], /*isIntersection*/ false); - case 193 /* SyntaxKind.TypeOperator */: - if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + case 195 /* SyntaxKind.TypeOperator */: + if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 181 /* SyntaxKind.TypeQuery */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 192 /* SyntaxKind.ThisType */: - case 200 /* SyntaxKind.ImportType */: + case 183 /* SyntaxKind.TypeQuery */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 194 /* SyntaxKind.ThisType */: + case 202 /* SyntaxKind.ImportType */: break; // handle JSDoc types from an invalid parse - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - case 319 /* SyntaxKind.JSDocNamepathType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 321 /* SyntaxKind.JSDocVariadicType */: + case 322 /* SyntaxKind.JSDocNamepathType */: break; - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -383777,7 +384723,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.factory.createIdentifier("String"); - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; switch (operand.kind) { case 8 /* SyntaxKind.NumericLiteral */: @@ -383806,20 +384752,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { if (isIntersection) return ts.factory.createVoidZero(); // Reduce to `never` in an intersection continue; // Elide `never` in a union } - if (typeNode.kind === 155 /* SyntaxKind.UnknownKeyword */) { + if (typeNode.kind === 157 /* SyntaxKind.UnknownKeyword */) { if (!isIntersection) return ts.factory.createIdentifier("Object"); // Reduce to `unknown` in a union continue; // Elide `unknown` in an intersection } - if (typeNode.kind === 130 /* SyntaxKind.AnyKeyword */) { + if (typeNode.kind === 131 /* SyntaxKind.AnyKeyword */) { return ts.factory.createIdentifier("Object"); // Reduce to `any` in a union or intersection } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var serializedConstituent = serializeTypeNode(typeNode); @@ -383967,7 +384913,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node. return name; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -384022,24 +384968,24 @@ var ts; return node; } switch (node.kind) { - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are elided. They will be emitted as part of `visitClassDeclaration`. return undefined; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructorDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitSetAccessorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return visitGetAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return visitPropertyDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -384395,7 +385341,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !ts.hasSyntacticModifier(member, 2 /* ModifierFlags.Ambient */)); var descriptor = languageVersion > 0 /* ScriptTarget.ES3 */ - ? member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? factory.createVoidZero() @@ -384658,34 +385604,37 @@ var ts; return node; } switch (node.kind) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitMethodDeclaration, node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionDeclaration, node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionExpression, node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithContext(1 /* ContextFlags.NonTopLevel */, visitArrowFunction, node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 174 /* SyntaxKind.GetAccessor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node); + case 175 /* SyntaxKind.SetAccessor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node); + case 173 /* SyntaxKind.Constructor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node); + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -384694,27 +385643,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatementInAsyncBody(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatementInAsyncBody(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClauseInAsyncBody(node); - case 235 /* SyntaxKind.Block */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 250 /* SyntaxKind.LabeledStatement */: + case 238 /* SyntaxKind.Block */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -384784,6 +385733,9 @@ var ts; return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression( /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node); } + function visitConstructorDeclaration(node) { + return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); + } /** * Visits a MethodDeclaration node. * @@ -384798,7 +385750,14 @@ var ts; /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */ ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : transformMethodBody(node)); + } + function visitGetAccessorDeclaration(node) { + return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformMethodBody(node)); + } + function visitSetAccessorDeclaration(node) { + return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); } /** * Visits a FunctionDeclaration node. @@ -384912,12 +385871,48 @@ var ts; } return false; } + function transformMethodBody(node) { + ts.Debug.assertIsDefined(node.body); + var savedCapturedSuperProperties = capturedSuperProperties; + var savedHasSuperElementAccess = hasSuperElementAccess; + capturedSuperProperties = new ts.Set(); + hasSuperElementAccess = false; + var updated = ts.visitFunctionBody(node.body, visitor, context); + // Minor optimization, emit `_super` helper to capture `super` access in an arrow. + // This step isn't needed if we eventually transform this to ES5. + var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && + resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) && + (ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */; + if (emitSuperHelpers) { + enableSubstitutionForAsyncMethodsWithSuper(); + if (capturedSuperProperties.size) { + var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); + substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true; + var statements = updated.statements.slice(); + ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]); + updated = factory.updateBlock(updated, statements); + } + if (hasSuperElementAccess) { + // Emit helpers for super element access expressions (`super[x]`). + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { + ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { + ts.addEmitHelper(updated, ts.asyncSuperHelper); + } + } + } + capturedSuperProperties = savedCapturedSuperProperties; + hasSuperElementAccess = savedHasSuperElementAccess; + return updated; + } function transformAsyncFunctionBody(node) { resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ScriptTarget.ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214 /* SyntaxKind.ArrowFunction */; + var isArrowFunction = node.kind === 216 /* SyntaxKind.ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* NodeCheckFlags.CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -384944,7 +385939,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. - var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */); if (emitSuperHelpers) { enableSubstitutionForAsyncMethodsWithSuper(); if (capturedSuperProperties.size) { @@ -384957,10 +385952,10 @@ var ts; ts.setTextRange(block, node.body); if (emitSuperHelpers && hasSuperElementAccess) { // Emit helpers for super element access expressions (`super[x]`). - if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) { + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { ts.addEmitHelper(block, ts.asyncSuperHelper); } } @@ -385008,17 +386003,17 @@ var ts; enabledSubstitutions |= 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -385032,7 +386027,7 @@ var ts; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */); + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; enclosingSuperContainerFlags = superContainerFlags; @@ -385066,11 +386061,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -385102,14 +386097,14 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { - if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } @@ -385124,7 +386119,7 @@ var ts; function createSuperAccessVariableStatement(factory, resolver, node, names) { // Create a variable declaration with a getter/setter (if binding) definition for each name: // const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... }); - var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) !== 0; + var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0; var accessors = []; names.forEach(function (_, key) { var name = ts.unescapeLeadingUnderscores(key); @@ -385263,7 +386258,7 @@ var ts; return visitorWorker(node, /*expressionResultIsUnused*/ true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131 /* SyntaxKind.AsyncKeyword */) { + if (node.kind === 132 /* SyntaxKind.AsyncKeyword */) { return undefined; } return node; @@ -385289,70 +386284,70 @@ var ts; return node; } switch (node.kind) { - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: return doWithHierarchyFacts(visitDefault, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return doWithHierarchyFacts(visitForStatement, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return doWithHierarchyFacts(visitConstructorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithHierarchyFacts(visitMethodDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithHierarchyFacts(visitFunctionExpression, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithHierarchyFacts(visitArrowFunction, node, 2 /* HierarchyFacts.ArrowFunctionExcludes */, 0 /* HierarchyFacts.ArrowFunctionIncludes */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithHierarchyFacts(visitDefault, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); default: return ts.visitEachChild(node, visitor, context); @@ -385388,7 +386383,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* FunctionFlags.Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 247 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -385400,7 +386395,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (e.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -385409,7 +386404,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 /* SyntaxKind.PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 299 /* SyntaxKind.PropertyAssignment */ ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -385443,7 +386438,7 @@ var ts; // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we // end up with `{ a: 1, b: 2, c: 3 }` var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -385617,11 +386612,22 @@ var ts; } return node; } - function convertForOfStatementHead(node, boundValue) { - var binding = ts.createForOfBindingStatement(factory, node.initializer, boundValue); + function convertForOfStatementHead(node, boundValue, nonUserCode) { + var value = factory.createTempVariable(hoistVariableDeclaration); + var iteratorValueExpression = factory.createAssignment(value, boundValue); + var iteratorValueStatement = factory.createExpressionStatement(iteratorValueExpression); + ts.setSourceMapRange(iteratorValueStatement, node.expression); + var exitNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createFalse()); + var exitNonUserCodeStatement = factory.createExpressionStatement(exitNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var enterNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createTrue()); + var enterNonUserCodeStatement = factory.createExpressionStatement(enterNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var statements = []; + var binding = ts.createForOfBindingStatement(factory, node.initializer, value); + statements.push(ts.visitNode(binding, visitor, ts.isStatement)); var bodyLocation; var statementsLocation; - var statements = [ts.visitNode(binding, visitor, ts.isStatement)]; var statement = ts.visitIterationBody(node.statement, visitor, context); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); @@ -385631,8 +386637,16 @@ var ts; else { statements.push(statement); } - return ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), + var body = ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), /*multiLine*/ true), bodyLocation), 48 /* EmitFlags.NoSourceMap */ | 384 /* EmitFlags.NoTokenSourceMaps */); + return factory.createBlock([ + iteratorValueStatement, + exitNonUserCodeStatement, + factory.createTryStatement(body, + /*catchClause*/ undefined, factory.createBlock([ + enterNonUserCodeStatement + ])) + ]); } function createDownlevelAwait(expression) { return enclosingFunctionFlags & 1 /* FunctionFlags.Generator */ @@ -385643,6 +386657,8 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isExpression); var iterator = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(/*recordTempVariable*/ undefined); var result = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable(/*recordTempVariable*/ undefined); + var nonUserCode = factory.createTempVariable(/*recordTempVariable*/ undefined); + var done = factory.createTempVariable(hoistVariableDeclaration); var errorRecord = factory.createUniqueName("e"); var catchVariable = factory.getGeneratedNameForNode(errorRecord); var returnMethod = factory.createTempVariable(/*recordTempVariable*/ undefined); @@ -385659,12 +386675,17 @@ var ts; callValues; var forStatement = ts.setEmitFlags(ts.setTextRange(factory.createForStatement( /*initializer*/ ts.setEmitFlags(ts.setTextRange(factory.createVariableDeclarationList([ + factory.createVariableDeclaration(nonUserCode, /*exclamationToken*/ undefined, /*type*/ undefined, factory.createTrue()), ts.setTextRange(factory.createVariableDeclaration(iterator, /*exclamationToken*/ undefined, /*type*/ undefined, initializer), node.expression), factory.createVariableDeclaration(result) ]), node.expression), 2097152 /* EmitFlags.NoHoisting */), - /*condition*/ factory.createComma(factory.createAssignment(result, createDownlevelAwait(callNext)), factory.createLogicalNot(getDone)), + /*condition*/ factory.inlineExpressions([ + factory.createAssignment(result, createDownlevelAwait(callNext)), + factory.createAssignment(done, getDone), + factory.createLogicalNot(done) + ]), /*incrementor*/ undefined, - /*statement*/ convertForOfStatementHead(node, getValue)), + /*statement*/ convertForOfStatementHead(node, getValue, nonUserCode)), /*location*/ node), 256 /* EmitFlags.NoTokenTrailingSourceMaps */); ts.setOriginalNode(forStatement, node); return factory.createTryStatement(factory.createBlock([ @@ -385676,7 +386697,7 @@ var ts; ]), 1 /* EmitFlags.SingleLine */)), factory.createBlock([ factory.createTryStatement( /*tryBlock*/ factory.createBlock([ - ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(result, factory.createLogicalNot(getDone)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */) + ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(factory.createLogicalNot(nonUserCode), factory.createLogicalNot(done)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */) ]), /*catchClause*/ undefined, /*finallyBlock*/ ts.setEmitFlags(factory.createBlock([ @@ -385832,7 +386853,7 @@ var ts; /*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */))); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. - var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */); if (emitSuperHelpers) { enableSubstitutionForAsyncMethodsWithSuper(); var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); @@ -385843,10 +386864,10 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var block = factory.updateBlock(node.body, statements); if (emitSuperHelpers && hasSuperElementAccess) { - if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) { + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { ts.addEmitHelper(block, ts.asyncSuperHelper); } } @@ -385951,17 +386972,17 @@ var ts; enabledSubstitutions |= 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -385975,7 +386996,7 @@ var ts; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */); + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; enclosingSuperContainerFlags = superContainerFlags; @@ -386009,11 +387030,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -386045,14 +387066,14 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { - if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } @@ -386081,7 +387102,7 @@ var ts; return node; } switch (node.kind) { - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -386113,25 +387134,25 @@ var ts; return node; } switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { var updated = visitNonOptionalCallExpression(node, /*captureThisArg*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, /*captureThisArg*/ false, /*isDelete*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -386173,7 +387194,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + expression = node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -386196,10 +387217,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -386218,8 +387239,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -386229,11 +387250,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + rightExpression = segment.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -386294,7 +387315,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -386463,13 +387484,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -386479,13 +387500,13 @@ var ts; switch (node.kind) { case 11 /* SyntaxKind.JsxText */: return visitJsxText(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -386666,7 +387687,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288 /* SyntaxKind.JsxExpression */) { + if (node.kind === 291 /* SyntaxKind.JsxExpression */) { if (node.expression === undefined) { return factory.createTrue(); } @@ -386767,7 +387788,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278 /* SyntaxKind.JsxElement */) { + if (node.kind === 281 /* SyntaxKind.JsxElement */) { return getTagName(node.openingElement); } else { @@ -387074,7 +388095,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -387299,7 +388320,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192 /* HierarchyFacts.ConstructorWithCapturedSuper */) !== 0 - && node.kind === 247 /* SyntaxKind.ReturnStatement */ + && node.kind === 250 /* SyntaxKind.ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -387353,65 +388374,65 @@ var ts; switch (node.kind) { case 124 /* SyntaxKind.StaticKeyword */: return undefined; // elide static keyword - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return visitArrowFunction(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); case 79 /* SyntaxKind.Identifier */: return visitIdentifier(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return visitVariableDeclarationList(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitBreakOrContinueStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return visitComputedPropertyName(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: @@ -387422,30 +388443,30 @@ var ts; return visitStringLiteral(node); case 8 /* SyntaxKind.NumericLiteral */: return visitNumericLiteral(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return visitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return visitSpreadElement(node); case 106 /* SyntaxKind.SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 108 /* SyntaxKind.ThisKeyword */: return visitThisKeyword(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return visitMetaProperty(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -387521,11 +388542,13 @@ var ts; return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context); } function visitIdentifier(node) { - if (!convertedLoopState) { - return node; + if (convertedLoopState) { + if (resolver.isArgumentsLocalBinding(node)) { + return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + } } - if (resolver.isArgumentsLocalBinding(node)) { - return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + if (node.hasExtendedUnicodeEscape) { + return ts.setOriginalNode(ts.setTextRange(factory.createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText)), node), node); } return node; } @@ -387535,14 +388558,14 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 246 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; + var jump = node.kind === 249 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Jump.Break */; labelMarker = "break"; } @@ -387553,7 +388576,7 @@ var ts; } } else { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker); } @@ -387609,7 +388632,7 @@ var ts; statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - var exportStatement = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) + var exportStatement = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -387978,11 +389001,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (statement.kind === 250 /* SyntaxKind.ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 239 /* SyntaxKind.IfStatement */) { + else if (statement.kind === 242 /* SyntaxKind.IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -387990,7 +389013,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 235 /* SyntaxKind.Block */) { + else if (statement.kind === 238 /* SyntaxKind.Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -388190,7 +389213,7 @@ var ts; * @param node A node. */ function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 216 /* SyntaxKind.ArrowFunction */) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -388224,22 +389247,22 @@ var ts; if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return statements; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = factory.createVoidZero(); break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), "constructor"); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), 102 /* SyntaxKind.InstanceOfKeyword */, factory.getLocalName(node))), @@ -388274,21 +389297,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -388487,7 +389510,7 @@ var ts; : enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) { + if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */); @@ -388533,7 +389556,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214 /* SyntaxKind.ArrowFunction */); + ts.Debug.assert(node.kind === 216 /* SyntaxKind.ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -388840,14 +389863,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -389033,7 +390056,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 /* TransformFlags.ContainsYield */ && hierarchyFacts & 4 /* HierarchyFacts.AsyncFunctionBody */) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162 /* SyntaxKind.ComputedPropertyName */)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164 /* SyntaxKind.ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -389149,11 +390172,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 244 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 240 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 241 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); + case 245 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); + case 247 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); + case 243 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); + case 244 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -389178,11 +390201,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer && initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -389598,20 +390621,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -389718,7 +390741,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -390178,13 +391201,13 @@ var ts; if ((enabledSubstitutions & 1 /* ES2015SubstitutionFlags.CapturedThis */) === 0) { enabledSubstitutions |= 1 /* ES2015SubstitutionFlags.CapturedThis */; context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(214 /* SyntaxKind.ArrowFunction */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(216 /* SyntaxKind.ArrowFunction */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); } } /** @@ -390225,10 +391248,10 @@ var ts; */ function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -390310,11 +391333,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238 /* SyntaxKind.ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241 /* SyntaxKind.ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -390322,7 +391345,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227 /* SyntaxKind.SpreadElement */) { return false; } var expression = callArgument.expression; @@ -390348,15 +391371,15 @@ var ts; if (compilerOptions.jsx === 1 /* JsxEmit.Preserve */ || compilerOptions.jsx === 3 /* JsxEmit.ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280 /* SyntaxKind.JsxOpeningElement */); - context.enableEmitNotification(281 /* SyntaxKind.JsxClosingElement */); - context.enableEmitNotification(279 /* SyntaxKind.JsxSelfClosingElement */); + context.enableEmitNotification(283 /* SyntaxKind.JsxOpeningElement */); + context.enableEmitNotification(284 /* SyntaxKind.JsxClosingElement */); + context.enableEmitNotification(282 /* SyntaxKind.JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(296 /* SyntaxKind.PropertyAssignment */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(299 /* SyntaxKind.PropertyAssignment */); return ts.chainBundle(context, transformSourceFile); /** * Transforms an ES5 source file to ES3. @@ -390375,9 +391398,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -390712,13 +391735,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -390731,24 +391754,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return visitBreakStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* TransformFlags.ContainsYield */) { @@ -390769,23 +391792,23 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return visitConditionalExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -390798,9 +391821,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -391007,7 +392030,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // [source] // a.b = yield; // @@ -391019,7 +392042,7 @@ var ts; // _a.b = %sent%; target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // [source] // a[b] = yield; // @@ -391413,35 +392436,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return transformAndEmitBlock(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return transformAndEmitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return transformAndEmitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return transformAndEmitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return transformAndEmitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return transformAndEmitForInStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return transformAndEmitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return transformAndEmitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return transformAndEmitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return transformAndEmitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return transformAndEmitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -391672,7 +392695,6 @@ var ts; return node; } function transformAndEmitForInStatement(node) { - // TODO(rbuckton): Source map locations if (containsYield(node)) { // [source] // for (var p in o) { @@ -391680,34 +392702,41 @@ var ts; // } // // [intermediate] - // .local _a, _b, _i - // _a = []; - // for (_b in o) _a.push(_b); + // .local _b, _a, _c, _i + // _b = []; + // _a = o; + // for (_c in _a) _b.push(_c); // _i = 0; // .loop incrementLabel, endLoopLabel // .mark conditionLabel - // .brfalse endLoopLabel, (_i < _a.length) - // p = _a[_i]; + // .brfalse endLoopLabel, (_i < _b.length) + // _c = _b[_i]; + // .brfalse incrementLabel, (_c in _a) + // p = _c; // /*body*/ // .mark incrementLabel - // _b++; + // _c++; // .br conditionLabel // .endloop // .mark endLoopLabel - var keysArray = declareLocal(); // _a - var key = declareLocal(); // _b + var obj = declareLocal(); // _a + var keysArray = declareLocal(); // _b + var key = declareLocal(); // _c var keysIndex = factory.createLoopVariable(); // _i var initializer = node.initializer; hoistVariableDeclaration(keysIndex); + emitAssignment(obj, ts.visitNode(node.expression, visitor, ts.isExpression)); emitAssignment(keysArray, factory.createArrayLiteralExpression()); - emitStatement(factory.createForInStatement(key, ts.visitNode(node.expression, visitor, ts.isExpression), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), + emitStatement(factory.createForInStatement(key, obj, factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), /*typeArguments*/ undefined, [key])))); emitAssignment(keysIndex, factory.createNumericLiteral(0)); var conditionLabel = defineLabel(); var incrementLabel = defineLabel(); - var endLabel = beginLoopBlock(incrementLabel); + var endLoopLabel = beginLoopBlock(incrementLabel); markLabel(conditionLabel); - emitBreakWhenFalse(endLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitBreakWhenFalse(endLoopLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitAssignment(key, factory.createElementAccessExpression(keysArray, keysIndex)); + emitBreakWhenFalse(incrementLabel, factory.createBinaryExpression(key, 101 /* SyntaxKind.InKeyword */, obj)); var variable = void 0; if (ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { @@ -391720,7 +392749,7 @@ var ts; variable = ts.visitNode(initializer, visitor, ts.isExpression); ts.Debug.assert(ts.isLeftHandSideExpression(variable)); } - emitAssignment(variable, factory.createElementAccessExpression(keysArray, keysIndex)); + emitAssignment(variable, key); transformAndEmitEmbeddedStatement(node.statement); markLabel(incrementLabel); emitStatement(factory.createExpressionStatement(factory.createPostfixIncrement(keysIndex))); @@ -391871,7 +392900,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -391884,7 +392913,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -393044,12 +394073,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. - context.enableSubstitution(210 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(212 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -393377,23 +394406,23 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -393406,26 +394435,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -393441,24 +394470,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -393561,7 +394590,7 @@ var ts; return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis); case ts.ModuleKind.CommonJS: default: - return createImportCallExpressionCommonJS(argument, containsLexicalThis); + return createImportCallExpressionCommonJS(argument); } } function createImportCallExpressionUMD(arg, containsLexicalThis) { @@ -393584,7 +394613,7 @@ var ts; return factory.createConditionalExpression( /*condition*/ factory.createIdentifier("__syncRequire"), /*questionToken*/ undefined, - /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis), + /*whenTrue*/ createImportCallExpressionCommonJS(arg), /*colonToken*/ undefined, /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis)); } @@ -393593,7 +394622,7 @@ var ts; return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression( /*condition*/ factory.createIdentifier("__syncRequire"), /*questionToken*/ undefined, - /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis), + /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true), /*colonToken*/ undefined, /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis))); } @@ -393643,14 +394672,20 @@ var ts; } return promise; } - function createImportCallExpressionCommonJS(arg, containsLexicalThis) { - // import("./blah") + function createImportCallExpressionCommonJS(arg, isInlineable) { + // import(x) // emit as - // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/ + // var _a; + // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/ // We have to wrap require in then callback so that require is done in asynchronously // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately - var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []); - var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []); + // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var + var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined; + var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), + /*typeArguments*/ undefined, + /*argumentsArray*/ []); + var requireCall = factory.createCallExpression(factory.createIdentifier("require"), + /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []); if (ts.getESModuleInterop(compilerOptions)) { requireCall = emitHelpers().createImportStarHelper(requireCall); } @@ -393671,14 +394706,9 @@ var ts; /*typeParameters*/ undefined, /*parameters*/ [], /*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)])); - // if there is a lexical 'this' in the import call arguments, ensure we indicate - // that this new function expression indicates it captures 'this' so that the - // es2015 transformer will properly substitute 'this' with '_this'. - if (containsLexicalThis) { - ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */); - } } - return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]); + var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]); + return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]); } function getHelperExpressionForExport(node, innerExpr) { if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) { @@ -394044,7 +395074,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -394099,10 +395129,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, /* liveBinding */ true); @@ -394186,7 +395216,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), /*location*/ decl); } if (decl.name) { @@ -394315,7 +395345,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -394377,11 +395407,11 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -394425,7 +395455,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64 /* GeneratedIdentifierFlags.AllowNameSubstitution */)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), /*location*/ node); } @@ -394515,10 +395545,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(231 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(233 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -394708,7 +395738,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); // TODO: GH#18217 var modifiers = node.transformFlags & 2097152 /* TransformFlags.ContainsAwait */ ? - factory.createModifiersFromModifierFlags(256 /* ModifierFlags.Async */) : + factory.createModifiersFromModifierFlags(512 /* ModifierFlags.Async */) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -394742,7 +395772,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 275 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -394831,19 +395861,26 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); // TODO: GH#18217 switch (entry.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1 /* ModifierFlags.Export */)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, + /*typeArguments*/ undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -394902,13 +395939,13 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -395087,7 +396124,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* EmitFlags.NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 305 /* SyntaxKind.SourceFile */ + && (enclosingBlockScopedContainer.kind === 308 /* SyntaxKind.SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* NodeFlags.BlockScoped */) === 0); } /** @@ -395151,7 +396188,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1 /* ModifierFlags.Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -395213,10 +396250,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -395311,7 +396348,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -395396,43 +396433,43 @@ var ts; */ function topLevelNestedVisitor(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ true); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return visitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return visitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return visitDefaultClause(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return visitTryStatement(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -395618,26 +396655,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -395717,7 +396754,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305 /* SyntaxKind.SourceFile */; + return container !== undefined && container.kind === 308 /* SyntaxKind.SourceFile */; } else { return false; @@ -395795,7 +396832,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -395845,7 +396882,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -395882,9 +396919,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return substituteMetaProperty(node); } return node; @@ -395974,7 +397011,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -396017,7 +397054,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); context.enableSubstitution(79 /* SyntaxKind.Identifier */); var helperNameSubstitutions; var currentSourceFile; @@ -396057,14 +397094,14 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call // To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url` // is available, just because the output is reasonable for a node-like runtime. return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -396221,8 +397258,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305 /* SyntaxKind.SourceFile */); - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableSubstitution(308 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -396269,7 +397306,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -396329,7 +397366,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -396358,7 +397395,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -396405,7 +397442,7 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -396414,8 +397451,8 @@ var ts; } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 166 /* SyntaxKind.PropertySignature */ || - (node.kind === 164 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { + else if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.PropertySignature */ || + (node.kind === 166 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? @@ -396424,7 +397461,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 166 /* SyntaxKind.Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -396449,7 +397486,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. if (ts.isStatic(node)) { @@ -396488,26 +397525,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -396515,7 +397552,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -396529,7 +397566,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -396554,30 +397591,30 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -396585,7 +397622,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -396598,15 +397635,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256 /* SyntaxKind.FunctionDeclaration */: - case 179 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -396620,39 +397657,39 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179 /* SyntaxKind.FunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -396718,7 +397755,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164 /* SyntaxKind.Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 166 /* SyntaxKind.Parameter */) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -396894,7 +397931,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -396924,10 +397961,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { + if (node.kind === 308 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -396950,14 +397987,14 @@ var ts; resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -397098,7 +398135,7 @@ var ts; return name; } else { - if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -397106,7 +398143,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (elem.kind === 229 /* SyntaxKind.OmittedExpression */) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -397148,19 +398185,19 @@ var ts; // Literal const declarations will have an initializer ensured rather than a type return; } - var shouldUseResolverType = node.kind === 164 /* SyntaxKind.Parameter */ && + var shouldUseResolverType = node.kind === 166 /* SyntaxKind.Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now // (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that) - return factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } errorNameNode = node.name; var oldDiag; @@ -397168,12 +398205,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 /* SyntaxKind.Parameter */ - || node.kind === 167 /* SyntaxKind.PropertyDeclaration */ - || node.kind === 166 /* SyntaxKind.PropertySignature */) { + if (node.kind === 166 /* SyntaxKind.Parameter */ + || node.kind === 169 /* SyntaxKind.PropertyDeclaration */ + || node.kind === 168 /* SyntaxKind.PropertySignature */) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -397184,28 +398221,28 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return returnValue || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !getBindingNameVisible(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; } return false; @@ -397294,7 +398331,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; // TODO: GH#18217 - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 200 /* SyntaxKind.ImportType */); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 202 /* SyntaxKind.ImportType */); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -397314,7 +398351,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (decl.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); @@ -397339,7 +398376,7 @@ var ts; return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; @@ -397442,7 +398479,7 @@ var ts; // We'd see a TDZ violation at runtime var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 /* SyntaxKind.TypeLiteral */ || input.kind === 195 /* SyntaxKind.MappedType */) && input.parent.kind !== 259 /* SyntaxKind.TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 /* SyntaxKind.TypeLiteral */ || input.kind === 197 /* SyntaxKind.MappedType */) && input.parent.kind !== 262 /* SyntaxKind.TypeAliasDeclaration */); // Emit methods which are private as properties with no type information if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)) { @@ -397463,28 +398500,28 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178 /* SyntaxKind.TypeReference */: { + case 180 /* SyntaxKind.TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { // A constructor declaration may not have a type annotation var ctor = factory.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), updateParamsList(input, input.parameters, 0 /* ModifierFlags.None */), /*body*/ undefined); return cleanup(ctor); } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -397493,7 +398530,7 @@ var ts; /*body*/ undefined); return cleanup(sig); } - case 172 /* SyntaxKind.GetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -397501,36 +398538,36 @@ var ts; return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), ensureType(input, accessorType), /*body*/ undefined)); } - case 173 /* SyntaxKind.SetAccessor */: { + case 175 /* SyntaxKind.SetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), /*body*/ undefined)); } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176 /* SyntaxKind.IndexSignature */: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */))); + case 178 /* SyntaxKind.IndexSignature */: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */))); } - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -397538,13 +398575,13 @@ var ts; suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types return cleanup(factory.updateVariableDeclaration(input, input.name, /*exclamationToken*/ undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163 /* SyntaxKind.TypeParameter */: { + case 165 /* SyntaxKind.TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, /*constraint*/ undefined, /*defaultType*/ undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189 /* SyntaxKind.ConditionalType */: { + case 191 /* SyntaxKind.ConditionalType */: { // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type. var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); @@ -397556,13 +398593,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179 /* SyntaxKind.FunctionType */: { + case 181 /* SyntaxKind.FunctionType */: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180 /* SyntaxKind.ConstructorType */: { + case 182 /* SyntaxKind.ConstructorType */: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200 /* SyntaxKind.ImportType */: { + case 202 /* SyntaxKind.ImportType */: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -397594,7 +398631,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); + return node.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -397604,7 +398641,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -397613,7 +398650,7 @@ var ts; // Rewrite external module names if necessary return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -397631,7 +398668,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -397644,12 +398681,12 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { // `export import` statements should remain as-is, as imports are _not_ implicitly exported in an ambient namespace // Likewise, `export default` classes and the like and just be `default`, so we preserve their `export` modifiers, too return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -397660,10 +398697,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -397684,12 +398721,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259 /* SyntaxKind.TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258 /* SyntaxKind.InterfaceDeclaration */: { + case 262 /* SyntaxKind.TypeAliasDeclaration */: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261 /* SyntaxKind.InterfaceDeclaration */: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), @@ -397730,10 +398771,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16 /* NodeFlags.Namespace */); - if (!ts.hasEffectiveModifier(clean, 512 /* ModifierFlags.Default */)) { + if (!ts.hasEffectiveModifier(clean, 1024 /* ModifierFlags.Default */)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, /*body*/ undefined); @@ -397751,10 +398792,10 @@ var ts; return clean; } } - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 264 /* SyntaxKind.ModuleDeclaration */: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (inner && inner.kind === 265 /* SyntaxKind.ModuleBlock */) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -397795,7 +398836,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257 /* SyntaxKind.ClassDeclaration */: { + case 260 /* SyntaxKind.ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -397857,7 +398898,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94 /* SyntaxKind.ExtendsKeyword */) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -397875,10 +398916,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 260 /* SyntaxKind.EnumDeclaration */: { + case 263 /* SyntaxKind.EnumDeclaration */: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -397897,7 +398938,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (input.kind === 264 /* SyntaxKind.ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -397920,7 +398961,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (e.kind === 229 /* SyntaxKind.OmittedExpression */) { return; } if (e.name) { @@ -397968,9 +399009,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 256 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files + var mask = 258047 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 512 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* ModifierFlags.Ambient */ : 0 /* ModifierFlags.None */; - var parentIsFile = node.parent.kind === 305 /* SyntaxKind.SourceFile */; + var parentIsFile = node.parent.kind === 308 /* SyntaxKind.SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2 /* ModifierFlags.Ambient */; additions = 0 /* ModifierFlags.None */; @@ -397999,7 +399040,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return true; } return false; @@ -398009,22 +399050,22 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } + if (modifierMask === void 0) { modifierMask = 258047 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* ModifierFlags.None */; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { + if (flags & 1024 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid flags ^= 1 /* ModifierFlags.Export */; } - if (flags & 512 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { + if (flags & 1024 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { flags ^= 2 /* ModifierFlags.Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 /* SyntaxKind.GetAccessor */ + return accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -398033,52 +399074,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return !ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */); - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 254 /* SyntaxKind.VariableDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: - case 189 /* SyntaxKind.ConditionalType */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 200 /* SyntaxKind.ImportType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 191 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 202 /* SyntaxKind.ImportType */: return true; } return false; @@ -398218,7 +399259,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355 /* SyntaxKind.Count */); + var enabledSyntaxKindFeatures = new Array(358 /* SyntaxKind.Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -398300,7 +399341,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 305 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 308 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -398706,7 +399747,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306 /* SyntaxKind.Bundle */) { + if (sourceFile.kind === 309 /* SyntaxKind.Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -399075,8 +400116,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -399126,7 +400167,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); + && (sourceFileOrBundle.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); } function getSourceRoot(mapOptions) { // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -399189,8 +400230,8 @@ var ts; } ts.getBuildInfoText = getBuildInfoText; /*@internal*/ - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; /*@internal*/ @@ -399268,17 +400309,16 @@ var ts; var buildInfo; if (host.getBuildInfo) { // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -399404,6 +400444,10 @@ var ts; var nodeIdToGeneratedName; // Map of generated names for specific nodes. var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. var generatedNames; // Set of names generated by the NameGenerator. + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; // Stack of enclosing name generation scopes. + var privateNameTempFlags; // TempFlags for the current name generation scope. var tempFlagsStack; // Stack of enclosing name generation scopes. var tempFlags; // TempFlags for the current name generation scope. var reservedNamesStack; // Stack of TempFlags reserved in enclosing name generation scopes. @@ -399469,9 +400513,9 @@ var ts; break; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: return printFile(node); - case 306 /* SyntaxKind.Bundle */: return printBundle(node); - case 307 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); + case 308 /* SyntaxKind.SourceFile */: return printFile(node); + case 309 /* SyntaxKind.Bundle */: return printBundle(node); + case 310 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -399662,6 +400706,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0 /* TempFlags.Auto */; tempFlagsStack = []; tempFlags = 0 /* TempFlags.Auto */; reservedNamesStack = []; @@ -399805,315 +400853,315 @@ var ts; return emitPrivateIdentifier(node); // Parse tree nodes // Names - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return emitQualifiedName(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return emitTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return emitParameter(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return emitDecorator(node); // Type members - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return emitPropertySignature(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return emitPropertyDeclaration(node); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return emitMethodSignature(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return emitMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return emitConstructor(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return emitAccessorDeclaration(node); - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return emitCallSignature(node); - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return emitConstructSignature(node); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return emitIndexSignature(node); // Types - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return emitTypePredicate(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return emitTypeReference(node); - case 179 /* SyntaxKind.FunctionType */: + case 181 /* SyntaxKind.FunctionType */: return emitFunctionType(node); - case 180 /* SyntaxKind.ConstructorType */: + case 182 /* SyntaxKind.ConstructorType */: return emitConstructorType(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return emitTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return emitTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return emitArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return emitTupleType(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return emitOptionalType(node); // SyntaxKind.RestType is handled below - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return emitUnionType(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return emitIntersectionType(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return emitConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return emitInferType(node); - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return emitParenthesizedType(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return emitThisType(); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return emitTypeOperator(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return emitIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return emitMappedType(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return emitLiteralType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return emitNamedTupleMember(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return emitTemplateType(node); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return emitImportTypeNode(node); // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return emitBindingElement(node); // Misc - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return emitTemplateSpan(node); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return emitBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return emitVariableStatement(node); - case 236 /* SyntaxKind.EmptyStatement */: + case 239 /* SyntaxKind.EmptyStatement */: return emitEmptyStatement(/*isEmbeddedStatement*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return emitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return emitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return emitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return emitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return emitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return emitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return emitForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return emitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return emitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return emitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return emitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return emitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return emitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return emitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return emitTryStatement(node); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return emitVariableDeclaration(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return emitVariableDeclarationList(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return emitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return emitClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return emitEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return emitModuleDeclaration(node); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return emitModuleBlock(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return emitCaseBlock(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return emitImportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return emitImportClause(node); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return emitNamespaceImport(node); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return emitNamespaceExport(node); - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: return emitNamedImports(node); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return emitImportSpecifier(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return emitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return emitExportDeclaration(node); - case 273 /* SyntaxKind.NamedExports */: + case 276 /* SyntaxKind.NamedExports */: return emitNamedExports(node); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return emitExportSpecifier(node); - case 293 /* SyntaxKind.AssertClause */: + case 296 /* SyntaxKind.AssertClause */: return emitAssertClause(node); - case 294 /* SyntaxKind.AssertEntry */: + case 297 /* SyntaxKind.AssertEntry */: return emitAssertEntry(node); - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return; // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 11 /* SyntaxKind.JsxText */: return emitJsxText(node); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 281 /* SyntaxKind.JsxClosingElement */: - case 284 /* SyntaxKind.JsxClosingFragment */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 287 /* SyntaxKind.JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return emitJsxAttribute(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return emitJsxAttributes(node); - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return emitJsxExpression(node); // Clauses - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return emitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return emitDefaultClause(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return emitHeritageClause(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return emitCatchClause(node); // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return emitPropertyAssignment(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return emitEnumMember(node); // Unparsed - case 300 /* SyntaxKind.UnparsedPrologue */: + case 303 /* SyntaxKind.UnparsedPrologue */: return writeUnparsedNode(node); - case 307 /* SyntaxKind.UnparsedSource */: - case 301 /* SyntaxKind.UnparsedPrepend */: + case 310 /* SyntaxKind.UnparsedSource */: + case 304 /* SyntaxKind.UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return emitUnparsedTextLike(node); - case 304 /* SyntaxKind.UnparsedSyntheticReference */: + case 307 /* SyntaxKind.UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return emitSourceFile(node); - case 306 /* SyntaxKind.Bundle */: + case 309 /* SyntaxKind.Bundle */: return ts.Debug.fail("Bundles should be printed using printBundle"); // SyntaxKind.UnparsedSource (handled above) - case 308 /* SyntaxKind.InputFiles */: + case 311 /* SyntaxKind.InputFiles */: return ts.Debug.fail("InputFiles should not be printed"); // JSDoc nodes (only used in codefixes currently) - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 310 /* SyntaxKind.JSDocNameReference */: + case 313 /* SyntaxKind.JSDocNameReference */: return emitJSDocNameReference(node); - case 312 /* SyntaxKind.JSDocAllType */: + case 315 /* SyntaxKind.JSDocAllType */: return writePunctuation("*"); - case 313 /* SyntaxKind.JSDocUnknownType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return writePunctuation("?"); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return emitJSDocNullableType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return emitJSDocOptionalType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return emitJSDocFunctionType(node); - case 186 /* SyntaxKind.RestType */: - case 318 /* SyntaxKind.JSDocVariadicType */: + case 188 /* SyntaxKind.RestType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 319 /* SyntaxKind.JSDocNamepathType */: + case 322 /* SyntaxKind.JSDocNamepathType */: return; - case 320 /* SyntaxKind.JSDoc */: + case 323 /* SyntaxKind.JSDoc */: return emitJSDoc(node); - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 323 /* SyntaxKind.JSDocSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return emitJSDocSignature(node); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: + case 330 /* SyntaxKind.JSDocTag */: + case 335 /* SyntaxKind.JSDocClassTag */: + case 340 /* SyntaxKind.JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 330 /* SyntaxKind.JSDocAuthorTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: + case 333 /* SyntaxKind.JSDocAuthorTag */: + case 334 /* SyntaxKind.JSDocDeprecatedTag */: return; // SyntaxKind.JSDocClassTag (see JSDocTag, above) - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 339 /* SyntaxKind.JSDocReadonlyTag */: return; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return emitJSDocCallbackTag(node); // SyntaxKind.JSDocEnumTag (see below) - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 339 /* SyntaxKind.JSDocEnumTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return emitJSDocSimpleTypedTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: return emitJSDocSeeTag(node); // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above) // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 352 /* SyntaxKind.NotEmittedStatement */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return; } if (ts.isExpression(node)) { @@ -400145,85 +401193,87 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: return emitPrivateIdentifier(node); // Expressions - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return emitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return emitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return emitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return emitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return emitArrowFunction(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return emitDeleteExpression(node); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return emitTypeOfExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return emitVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return emitAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return emitBinaryExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return emitConditionalExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return emitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return emitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return emitSpreadElement(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return emitClassExpression(node); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: return emitAsExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return emitNonNullExpression(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return emitSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return emitMetaProperty(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return ts.Debug.fail("SyntheticExpression should never be printed."); // JSX - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return emitJsxElement(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return emitJsxFragment(node); // Synthesized list - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.Debug.fail("SyntaxList should not be printed"); // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: + case 352 /* SyntaxKind.NotEmittedStatement */: return; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return emitCommaList(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return; - case 354 /* SyntaxKind.SyntheticReferenceExpression */: + case 357 /* SyntaxKind.SyntheticReferenceExpression */: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -400271,7 +401321,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 /* SyntaxKind.Bundle */ ? node : undefined; + var bundle = node.kind === 309 /* SyntaxKind.Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -400371,7 +401421,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 /* SyntaxKind.UnparsedText */ ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 /* SyntaxKind.UnparsedText */ ? "text" /* BundleFileSectionKind.Text */ : "internal" /* BundleFileSectionKind.Internal */); } @@ -400408,7 +401458,7 @@ var ts; } function emitTabStop(hint, node, snippet) { // A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text. - ts.Debug.assert(node.kind === 236 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5 /* EmitHint.EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -400469,7 +401519,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -400530,7 +401580,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 /* SyntaxKind.GetAccessor */ ? "get" : "set"); + writeKeyword(node.kind === 174 /* SyntaxKind.GetAccessor */ ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -400703,7 +401753,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + var parenthesizerRule = node.operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -400726,7 +401776,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -400972,7 +402022,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(133 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -400997,7 +402047,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ + return operand.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && ((node.operator === 39 /* SyntaxKind.PlusToken */ && (operand.operator === 39 /* SyntaxKind.PlusToken */ || operand.operator === 45 /* SyntaxKind.PlusPlusToken */)) || (node.operator === 40 /* SyntaxKind.MinusToken */ && (operand.operator === 40 /* SyntaxKind.MinusToken */ || operand.operator === 46 /* SyntaxKind.MinusMinusToken */))); } @@ -401145,6 +402195,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, /*parenthesizerRules*/ undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -401202,7 +402261,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91 /* SyntaxKind.ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239 /* SyntaxKind.IfStatement */) { + if (node.elseStatement.kind === 242 /* SyntaxKind.IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -401265,7 +402324,7 @@ var ts; emitTokenWithComment(20 /* SyntaxKind.OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* SyntaxKind.CloseParenToken */, node.expression.end, writePunctuation, node); @@ -401273,7 +402332,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { emit(node); } else { @@ -401310,7 +402369,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288 /* SyntaxKind.JsxExpression */; + var isJsxExprContext = contextNode.kind === 291 /* SyntaxKind.JsxExpression */; emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ !isJsxExprContext, /*forceNoNewline*/ isJsxExprContext); } return pos; @@ -401620,7 +402679,7 @@ var ts; emitTokenWithComment(100 /* SyntaxKind.ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -401645,7 +402704,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -401656,7 +402715,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -401669,7 +402728,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -401695,10 +402754,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -401710,7 +402770,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -401720,7 +402780,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(130 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226 /* ListFormat.ImportClauseEntries */); @@ -401740,9 +402800,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -401750,7 +402810,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -401773,7 +402833,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -401994,7 +403054,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -402039,7 +403099,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */) { + if (tag.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -402058,7 +403118,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 325 /* SyntaxKind.JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -402991,13 +404051,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -403021,7 +404081,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 /* SyntaxKind.StringLiteral */ && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216 /* EmitFlags.NoAsciiEscaping */) ? "\"".concat(ts.escapeString(text), "\"") : @@ -403045,7 +404105,11 @@ var ts; return; } tempFlagsStack.push(tempFlags); - tempFlags = 0; + tempFlags = 0 /* TempFlags.Auto */; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0 /* TempFlags.Auto */; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } /** @@ -403056,6 +404120,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -403068,84 +404134,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: ts.forEach(node.statements, generateNames); break; - case 250 /* SyntaxKind.LabeledStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: generateNames(node.statement); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: generateNames(node.caseBlock); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: ts.forEach(node.clauses, generateNames); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: ts.forEach(node.statements, generateNames); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: generateNames(node.declarationList); break; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: ts.forEach(node.declarations, generateNames); break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288 /* EmitFlags.ReuseTempVariableScope */) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: ts.forEach(node.elements, generateNames); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: generateNames(node.importClause); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: generateNameIfNeeded(node.name); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: generateNameIfNeeded(node.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: ts.forEach(node.elements, generateNames); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -403154,19 +404220,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -403181,7 +404247,7 @@ var ts; if ((name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) === 4 /* GeneratedIdentifierFlags.Node */) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -403190,9 +404256,9 @@ var ts; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0 /* GeneratedIdentifierFlags.None */, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } /** * Returns a value indicating whether a name is unique globally, within the current file, @@ -403224,20 +404290,53 @@ var ts; } return true; } + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0 /* TempFlags.Auto */; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } /** * Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. */ - function makeTempVariableName(flags, reservedInNestedScopes) { + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } + // Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name. + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 /* TempFlags._i */ ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -403248,11 +404347,13 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 /* CharacterCodes.a */ + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } @@ -403264,17 +404365,24 @@ var ts; * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } // Find the first unique 'name_n', where n is a positive number @@ -403283,21 +404391,21 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. @@ -403305,7 +404413,7 @@ var ts; function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for an ImportDeclaration or ExportDeclaration. @@ -403314,89 +404422,76 @@ var ts; var expr = ts.getExternalModuleName(node); // TODO: GH#18217 var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a default export. */ function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a class expression. */ function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reservedInNestedScopes*/ false, privateName, prefix, suffix); } /** * Generates a unique name from a node. */ - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 80 /* SyntaxKind.PrivateIdentifier */: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), privateName, prefix, suffix); + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return generateNameForMethodOrAccessor(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true); + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164 /* SyntaxKind.ComputedPropertyName */: + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true, privateName, prefix, suffix); default: - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ false, privateName, prefix, suffix); } } /** * Generates a unique identifier for a node. */ function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) { case 1 /* GeneratedIdentifierFlags.Auto */: - return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); case 2 /* GeneratedIdentifierFlags.Loop */: - return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), /*privateName*/ false, prefix, suffix); case 3 /* GeneratedIdentifierFlags.Unique */: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - /** - * Gets the node from which a name should be generated. - */ - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - // if "node" is a different generated name (having a different - // "autoGenerateId"), use it and stop traversing. - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; - } - // otherwise, return the original node for the source; - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */, ts.GeneratedIdentifierFlags, /*isFlags*/ true), ".")); } // Comments function pipelineEmitWithComments(hint, node) { @@ -403442,7 +404537,7 @@ var ts; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { - emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 349 /* SyntaxKind.NotEmittedStatement */); + emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 352 /* SyntaxKind.NotEmittedStatement */); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512 /* EmitFlags.NoLeadingComments */) !== 0)) { // Advance the container position if comments get emitted or if they've been disabled explicitly using NoLeadingComments. @@ -403453,7 +404548,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -403472,7 +404567,7 @@ var ts; declarationListContainerEnd = savedDeclarationListContainerEnd; // Emit trailing comments if the position is not synthesized and the node // has not opted out from emitting leading comments and is an emitted node. - if (!skipTrailingComments && node.kind !== 349 /* SyntaxKind.NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 352 /* SyntaxKind.NotEmittedStatement */) { emitTrailingComments(end); } } @@ -403753,7 +404848,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 16 /* EmitFlags.NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -403771,7 +404866,7 @@ var ts; if (emitFlags & 64 /* EmitFlags.NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 32 /* EmitFlags.NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -403936,7 +405031,16 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + // If we're looking for the base directory, we're definitely going to search the entries + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -403979,21 +405083,10 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + // Case-sensitive comparison since already canonicalized + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -404006,7 +405099,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -404016,9 +405109,14 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, /*isValid*/ true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -404087,7 +405185,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { // Folder added or removed, clear the cache instead of updating the folder and its structure clearCache(); } @@ -404107,7 +405205,23 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + // Case-sensitive comparison since already canonicalized + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -404587,14 +405701,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -404619,13 +405735,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); }; @@ -404867,7 +405985,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; /** * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. @@ -405067,7 +406184,7 @@ var ts; * Determines if program structure is upto date or needs to be recreated */ /* @internal */ - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { // If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; @@ -405095,7 +406212,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -405341,7 +406458,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. @@ -405788,7 +406905,7 @@ var ts; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -406024,7 +407141,7 @@ var ts; // tentatively approve the file modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { // 'module/types' references could have changed structureIsReused = 1 /* StructureIsReused.SafeModules */; // add file to the modified list so that we will resolve it later @@ -406412,22 +407529,22 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } // falls through - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 257 /* SyntaxKind.VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); @@ -406435,65 +407552,68 @@ var ts; } } switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: var heritageClause = node; if (heritageClause.token === 117 /* SyntaxKind.ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: var interfaceKeyword = ts.tokenToString(118 /* SyntaxKind.InterfaceKeyword */); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261 /* SyntaxKind.ModuleDeclaration */: - var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(142 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(141 /* SyntaxKind.ModuleKeyword */); + case 264 /* SyntaxKind.ModuleDeclaration */: + var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(143 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(142 /* SyntaxKind.ModuleKeyword */); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92 /* SyntaxKind.EnumKeyword */)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213 /* SyntaxKind.TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } } @@ -406502,53 +407622,55 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } // falls through - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237 /* SyntaxKind.VariableStatement */); + checkModifiers(parent.modifiers, parent.kind === 240 /* SyntaxKind.VariableStatement */); return "skip"; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ + && modifier.kind !== 127 /* SyntaxKind.AccessorKeyword */) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); @@ -406570,18 +407692,19 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; // These are all legal modifiers. case 124 /* SyntaxKind.StaticKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: } } } @@ -407506,10 +408629,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* ScriptKind.JSON */; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6 /* ScriptKind.JSON */) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ScriptTarget.ES2015 */ && options.module === ts.ModuleKind.None) { @@ -408760,10 +409885,16 @@ var ts; var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined; var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions); + // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged, + // which will eg be depedent on change in options like declarationDir and outDir options are unchanged. + // We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because + // oldCompilerOptions can be undefined if there was change in say module from None to some other option + // which would make useOldState as false since we can now use reference maps that are needed to track what to emit, what to check etc + // but that option change does not affect d.ts file name so emitSignatures should still be reused. var canCopyEmitSignatures = compilerOptions.composite && (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) && !outFilePath && - !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions); + !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions); if (useOldState) { // Copy old state's changed files set (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); }); @@ -409978,7 +411109,7 @@ var ts; var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */; if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths - pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) { // Dos style nextPart + pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1); if (nextDirectorySeparator === -1) { // ignore "//vda1cs4850/c$/folderAtRoot" @@ -410062,7 +411193,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -410117,17 +411248,13 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { // Ensure pending resolutions are applied invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - // Any file asked would have invalidated resolution - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -411488,15 +412615,21 @@ var ts; return undefined; } function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) { - var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); - if (normalizedTargetPath === undefined) { + var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); + if (normalizedTargetPaths === undefined) { + return undefined; + } + var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); + var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) { + return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); }); + }); + var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators); + if (!shortest) { return undefined; } - var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); - var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath; return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs - ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions) - : ts.removeFileExtension(relativePath); + ? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions) + : ts.removeFileExtension(shortest); } function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) { var path = _a.path, isRedirect = _a.isRedirect; @@ -411633,8 +412766,8 @@ var ts; } } } - function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { - return ts.firstDefined(rootDirs, function (rootDir) { + function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { + return ts.mapDefined(rootDirs, function (rootDir) { var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName); return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath; }); @@ -412345,18 +413478,14 @@ var ts; if (host.getBuildInfo) { // host provides buildinfo, get it from there. This allows host to cache it buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -412511,6 +413640,10 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); // Update the wild card directory watch @@ -412576,9 +413709,9 @@ var ts; resolutionCache.clear(); } } - // All resolutions are invalid if user provided resolutions - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); + var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -412591,15 +413724,20 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { // Compile the program writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); @@ -412610,7 +413748,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); @@ -413074,19 +414212,20 @@ var ts; */ UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; /** * Projects with no outputs (i.e. "solution" files) */ - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json" /* Extension.Json */)) { @@ -413304,6 +414443,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -413318,6 +414458,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -413517,6 +414659,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -413610,6 +414753,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -413788,13 +414935,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -414087,8 +415234,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -414173,7 +415319,14 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + // Error reading buildInfo + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -414182,8 +415335,15 @@ var ts; } if (buildInfo.program) { // If there are pending changes that are not emitted, project is out of date + // When there are syntax errors, changeFileSet will have list of files changed (irrespective of noEmit) + // But in case of semantic error we need special treatment. + // Checking presence of affectedFilesPendingEmit list is fast and good way to tell if there were semantic errors and file emit was blocked + // But if noEmit is true, affectedFilesPendingEmit will have file list even if there are no semantic errors to preserve list of files to be emitted when running with noEmit false + // So with noEmit set to true, check on semantic diagnostics needs to be explicit as oppose to when it is false when only files pending emit is sufficient if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) || - (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) { + (!project.options.noEmit ? + (_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length : + ts.some(buildInfo.program.semanticDiagnosticsPerFile, ts.isArray))) { return { type: ts.UpToDateStatusType.OutOfDateBuildInfo, buildInfoFile: buildInfoPath @@ -414358,7 +415518,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -414496,6 +415659,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -414523,6 +415693,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -414596,6 +415773,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -414628,7 +415813,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -414683,6 +415868,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -414700,6 +415886,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -414813,6 +416001,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: @@ -415334,6 +416524,12 @@ var ts; SemanticClassificationFormat["Original"] = "original"; SemanticClassificationFormat["TwentyTwenty"] = "2020"; })(SemanticClassificationFormat = ts.SemanticClassificationFormat || (ts.SemanticClassificationFormat = {})); + var OrganizeImportsMode; + (function (OrganizeImportsMode) { + OrganizeImportsMode["All"] = "All"; + OrganizeImportsMode["SortAndCombine"] = "SortAndCombine"; + OrganizeImportsMode["RemoveUnused"] = "RemoveUnused"; + })(OrganizeImportsMode = ts.OrganizeImportsMode || (ts.OrganizeImportsMode = {})); var CompletionTriggerKind; (function (CompletionTriggerKind) { /** Completion was triggered by typing an identifier, manual invocation (e.g Ctrl+Space) or via API. */ @@ -415520,6 +416716,8 @@ var ts; * interface Y { foo:number; } */ ScriptElementKind["memberVariableElement"] = "property"; + /** class X { [public|private]* accessor foo: number; } */ + ScriptElementKind["memberAccessorVariableElement"] = "accessor"; /** * class X { constructor() { } } * class X { static { } } @@ -415652,37 +416850,37 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* SemanticMeaning.All */ : 1 /* SemanticMeaning.Value */; - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 292 /* SyntaxKind.CatchClause */: - case 285 /* SyntaxKind.JsxAttribute */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 295 /* SyntaxKind.CatchClause */: + case 288 /* SyntaxKind.JsxAttribute */: return 1 /* SemanticMeaning.Value */; - case 163 /* SyntaxKind.TypeParameter */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 165 /* SyntaxKind.TypeParameter */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: return 2 /* SemanticMeaning.Type */; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */ : 2 /* SemanticMeaning.Type */; - case 299 /* SyntaxKind.EnumMember */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: return 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } @@ -415692,16 +416890,16 @@ var ts; else { return 4 /* SemanticMeaning.Namespace */; } - case 260 /* SyntaxKind.EnumDeclaration */: - case 269 /* SyntaxKind.NamedImports */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 272 /* SyntaxKind.NamedImports */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return 7 /* SemanticMeaning.All */; // An external module can be a Value - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } return 7 /* SemanticMeaning.All */; @@ -415710,7 +416908,7 @@ var ts; function getMeaningFromLocation(node) { node = getAdjustedReferenceLocation(node); var parent = node.parent; - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return 1 /* SemanticMeaning.Value */; } else if (ts.isExportAssignment(parent) @@ -415753,11 +416951,11 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - var name = node.kind === 161 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; + var name = node.kind === 163 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; + return name && name.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -415769,27 +416967,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { - while (root.parent && root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { + while (root.parent && root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 178 /* SyntaxKind.TypeReference */ && !isLastClause; + return root.parent.kind === 180 /* SyntaxKind.TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */) { + if (!isLastClause && root.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 257 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || - (decl.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); + return (decl.kind === 260 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || + (decl.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); } return false; } @@ -415800,15 +416998,15 @@ var ts; switch (node.kind) { case 108 /* SyntaxKind.ThisKeyword */: return !ts.isExpressionNode(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return true; } switch (node.parent.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return true; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return !node.parent.isTypeOf; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isPartOfTypeNode(node.parent); } return false; @@ -415875,7 +417073,7 @@ var ts; ts.climbPastPropertyOrElementAccess = climbPastPropertyOrElementAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 250 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 253 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -415936,22 +417134,22 @@ var ts; ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.parent.argumentExpression === node; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return true; - case 196 /* SyntaxKind.LiteralType */: - return node.parent.parent.kind === 194 /* SyntaxKind.IndexedAccessType */; + case 198 /* SyntaxKind.LiteralType */: + return node.parent.parent.kind === 196 /* SyntaxKind.IndexedAccessType */; default: return false; } @@ -415975,17 +417173,17 @@ var ts; return undefined; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node; } } @@ -415993,56 +417191,56 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node) ? "module" /* ScriptElementKind.moduleElement */ : "script" /* ScriptElementKind.scriptElement */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return "module" /* ScriptElementKind.moduleElement */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return "class" /* ScriptElementKind.classElement */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return "type" /* ScriptElementKind.typeElement */; - case 260 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; - case 254 /* SyntaxKind.VariableDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; + case 257 /* SyntaxKind.VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return "function" /* ScriptElementKind.functionElement */; - case 172 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; - case 173 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; + case 175 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return "method" /* ScriptElementKind.memberFunctionElement */; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: var initializer = node.initializer; return ts.isFunctionLike(initializer) ? "method" /* ScriptElementKind.memberFunctionElement */ : "property" /* ScriptElementKind.memberVariableElement */; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return "property" /* ScriptElementKind.memberVariableElement */; - case 176 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; - case 175 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; - case 174 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; + case 177 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; + case 176 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return "constructor" /* ScriptElementKind.constructorImplementationElement */; - case 163 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; - case 299 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; - case 164 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: + case 165 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; + case 302 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; + case 166 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: return "alias" /* ScriptElementKind.alias */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var kind = ts.getAssignmentDeclarationKind(node); var right = node.right; switch (kind) { @@ -416071,7 +417269,7 @@ var ts; } case 79 /* SyntaxKind.Identifier */: return ts.isImportClause(node.parent) ? "alias" /* ScriptElementKind.alias */ : "" /* ScriptElementKind.unknown */; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: var scriptKind = getNodeKind(node.expression); // If the expression didn't come back with something (like it does for an identifiers) return scriptKind === "" /* ScriptElementKind.unknown */ ? "const" /* ScriptElementKind.constElement */ : scriptKind; @@ -416094,7 +417292,7 @@ var ts; return true; case 79 /* SyntaxKind.Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 164 /* SyntaxKind.Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 166 /* SyntaxKind.Parameter */; default: return false; } @@ -416159,42 +417357,42 @@ var ts; return false; } switch (n.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 182 /* SyntaxKind.TypeLiteral */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 263 /* SyntaxKind.CaseBlock */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 184 /* SyntaxKind.TypeLiteral */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 266 /* SyntaxKind.CaseBlock */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return nodeEndsWith(n, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return isCompletedNode(n.block, sourceFile); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: if (!n.arguments) { return true; } // falls through - case 208 /* SyntaxKind.CallExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 191 /* SyntaxKind.ParenthesizedType */: + case 210 /* SyntaxKind.CallExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: return nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 216 /* SyntaxKind.ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -416204,65 +417402,65 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return !!n.body && isCompletedNode(n.body, sourceFile); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 26 /* SyntaxKind.SemicolonToken */, sourceFile); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 184 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 186 /* SyntaxKind.TupleType */: return nodeEndsWith(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; return hasChildOfKind(n, 115 /* SyntaxKind.WhileKeyword */, sourceFile) ? nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 216 /* SyntaxKind.TypeOfExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 225 /* SyntaxKind.SpreadElement */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 227 /* SyntaxKind.SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -416377,6 +417575,8 @@ var ts; return lastTypeNode; } function getContextualTypeFromParentOrAncestorTypeNode(node, checker) { + if (node.flags & (8388608 /* NodeFlags.JSDoc */ & ~262144 /* NodeFlags.JavaScriptFile */)) + return undefined; var contextualType = getContextualTypeFromParent(node, checker); if (contextualType) return contextualType; @@ -416387,13 +417587,13 @@ var ts; function getAdjustedLocationForDeclaration(node, forRename) { if (!forRename) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return getAdjustedLocationForClass(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return getAdjustedLocationForFunction(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return node; } } @@ -416488,11 +417688,11 @@ var ts; node.kind === 98 /* SyntaxKind.FunctionKeyword */ ? ts.isFunctionDeclaration(parent) || ts.isFunctionExpression(node) : node.kind === 118 /* SyntaxKind.InterfaceKeyword */ ? ts.isInterfaceDeclaration(parent) : node.kind === 92 /* SyntaxKind.EnumKeyword */ ? ts.isEnumDeclaration(parent) : - node.kind === 152 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : - node.kind === 142 /* SyntaxKind.NamespaceKeyword */ || node.kind === 141 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : + node.kind === 154 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : + node.kind === 143 /* SyntaxKind.NamespaceKeyword */ || node.kind === 142 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : node.kind === 100 /* SyntaxKind.ImportKeyword */ ? ts.isImportEqualsDeclaration(parent) : - node.kind === 136 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : - node.kind === 149 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { + node.kind === 137 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : + node.kind === 151 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { var location = getAdjustedLocationForDeclaration(parent, forRename); if (location) { return location; @@ -416506,7 +417706,7 @@ var ts; return decl.name; } } - if (node.kind === 152 /* SyntaxKind.TypeKeyword */) { + if (node.kind === 154 /* SyntaxKind.TypeKeyword */) { // import /**/type [|name|] from ...; // import /**/type { [|name|] } from ...; // import /**/type { propertyName as [|name|] } from ...; @@ -416532,7 +417732,7 @@ var ts; // import * /**/as [|name|] ... // export { propertyName /**/as [|name|] } ... // export * /**/as [|name|] ... - if (node.kind === 127 /* SyntaxKind.AsKeyword */) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */) { if (ts.isImportSpecifier(parent) && parent.propertyName || ts.isExportSpecifier(parent) && parent.propertyName || ts.isNamespaceImport(parent) || @@ -416573,12 +417773,12 @@ var ts; } } // import name = /**/require("[|module|]"); - if (node.kind === 146 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { + if (node.kind === 147 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { return parent.expression; } // import ... /**/from "[|module|]"; // export ... /**/from "[|module|]"; - if (node.kind === 156 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { + if (node.kind === 158 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { return parent.moduleSpecifier; } // class ... /**/extends [|name|] ... @@ -416603,7 +417803,7 @@ var ts; } } // ... T extends /**/infer [|U|] ? ... - if (node.kind === 137 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { + if (node.kind === 138 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { return parent.typeParameter.name; } // { [ [|K|] /**/in keyof T]: ... } @@ -416611,12 +417811,12 @@ var ts; return parent.name; } // /**/keyof [|T|] - if (node.kind === 140 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 140 /* SyntaxKind.KeyOfKeyword */ && + if (node.kind === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // /**/readonly [|name|][] - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */ && + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isArrayTypeNode(parent.type) && ts.isTypeReferenceNode(parent.type.elementType)) { return parent.type.elementType.typeName; } @@ -416634,7 +417834,7 @@ var ts; if (node.kind === 103 /* SyntaxKind.NewKeyword */ && ts.isNewExpression(parent) || node.kind === 114 /* SyntaxKind.VoidKeyword */ && ts.isVoidExpression(parent) || node.kind === 112 /* SyntaxKind.TypeOfKeyword */ && ts.isTypeOfExpression(parent) || - node.kind === 132 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || + node.kind === 133 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || node.kind === 125 /* SyntaxKind.YieldKeyword */ && ts.isYieldExpression(parent) || node.kind === 89 /* SyntaxKind.DeleteKeyword */ && ts.isDeleteExpression(parent)) { if (parent.expression) { @@ -416647,13 +417847,13 @@ var ts; return ts.skipOuterExpressions(parent.right); } // left /**/as [|name|] - if (node.kind === 127 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // for (... /**/in [|name|]) // for (... /**/of [|name|]) if (node.kind === 101 /* SyntaxKind.InKeyword */ && ts.isForInStatement(parent) || - node.kind === 160 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { + node.kind === 162 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { return ts.skipOuterExpressions(parent.expression); } } @@ -416885,7 +418085,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 305 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 308 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -416916,7 +418116,7 @@ var ts; for (var i = exclusiveStartPosition - 1; i >= 0; i--) { var child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) { - if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); } } @@ -416960,17 +418160,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
|
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return true; } return false; @@ -417001,7 +418201,7 @@ var ts; function isInsideJsxElement(sourceFile, position) { function isInsideJsxElementTraversal(node) { while (node) { - if (node.kind >= 279 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 288 /* SyntaxKind.JsxExpression */ + if (node.kind >= 282 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 291 /* SyntaxKind.JsxExpression */ || node.kind === 11 /* SyntaxKind.JsxText */ || node.kind === 29 /* SyntaxKind.LessThanToken */ || node.kind === 31 /* SyntaxKind.GreaterThanToken */ @@ -417011,7 +418211,7 @@ var ts; || node.kind === 43 /* SyntaxKind.SlashToken */) { node = node.parent; } - else if (node.kind === 278 /* SyntaxKind.JsxElement */) { + else if (node.kind === 281 /* SyntaxKind.JsxElement */) { if (position > node.getStart(sourceFile)) return true; node = node.parent; @@ -417159,7 +418359,7 @@ var ts; // falls through case 112 /* SyntaxKind.TypeOfKeyword */: case 94 /* SyntaxKind.ExtendsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: case 24 /* SyntaxKind.DotToken */: case 51 /* SyntaxKind.BarToken */: case 57 /* SyntaxKind.QuestionToken */: @@ -417180,7 +418380,7 @@ var ts; /** * Returns true if the cursor at position in sourceFile is within a comment. * - * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position) + * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position)` * @param predicate Additional predicate to test on the comment range. */ function isInComment(sourceFile, position, tokenAtPosition) { @@ -417211,7 +418411,7 @@ var ts; result.push("public" /* ScriptElementKindModifier.publicMemberModifier */); if (flags & 32 /* ModifierFlags.Static */ || ts.isClassStaticBlockDeclaration(node)) result.push("static" /* ScriptElementKindModifier.staticModifier */); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push("abstract" /* ScriptElementKindModifier.abstractModifier */); if (flags & 1 /* ModifierFlags.Export */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); @@ -417219,16 +418419,16 @@ var ts; result.push("deprecated" /* ScriptElementKindModifier.deprecatedModifier */); if (node.flags & 16777216 /* NodeFlags.Ambient */) result.push("declare" /* ScriptElementKindModifier.ambientModifier */); - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); return result.length > 0 ? result.join(",") : "" /* ScriptElementKindModifier.none */; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 210 /* SyntaxKind.CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -417273,18 +418473,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || - node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || + node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + if (node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -417292,7 +418492,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -417354,32 +418554,32 @@ var ts; } ts.createTextChange = createTextChange; ts.typeKeywords = [ - 130 /* SyntaxKind.AnyKeyword */, - 128 /* SyntaxKind.AssertsKeyword */, - 158 /* SyntaxKind.BigIntKeyword */, - 133 /* SyntaxKind.BooleanKeyword */, + 131 /* SyntaxKind.AnyKeyword */, + 129 /* SyntaxKind.AssertsKeyword */, + 160 /* SyntaxKind.BigIntKeyword */, + 134 /* SyntaxKind.BooleanKeyword */, 95 /* SyntaxKind.FalseKeyword */, - 137 /* SyntaxKind.InferKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 143 /* SyntaxKind.NeverKeyword */, + 138 /* SyntaxKind.InferKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 144 /* SyntaxKind.NeverKeyword */, 104 /* SyntaxKind.NullKeyword */, - 147 /* SyntaxKind.NumberKeyword */, - 148 /* SyntaxKind.ObjectKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 150 /* SyntaxKind.StringKeyword */, - 151 /* SyntaxKind.SymbolKeyword */, + 148 /* SyntaxKind.NumberKeyword */, + 149 /* SyntaxKind.ObjectKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 152 /* SyntaxKind.StringKeyword */, + 153 /* SyntaxKind.SymbolKeyword */, 110 /* SyntaxKind.TrueKeyword */, 114 /* SyntaxKind.VoidKeyword */, - 153 /* SyntaxKind.UndefinedKeyword */, - 154 /* SyntaxKind.UniqueKeyword */, - 155 /* SyntaxKind.UnknownKeyword */, + 155 /* SyntaxKind.UndefinedKeyword */, + 156 /* SyntaxKind.UniqueKeyword */, + 157 /* SyntaxKind.UnknownKeyword */, ]; function isTypeKeyword(kind) { return ts.contains(ts.typeKeywords, kind); } ts.isTypeKeyword = isTypeKeyword; function isTypeKeywordToken(node) { - return node.kind === 152 /* SyntaxKind.TypeKeyword */; + return node.kind === 154 /* SyntaxKind.TypeKeyword */; } ts.isTypeKeywordToken = isTypeKeywordToken; function isTypeKeywordTokenOrIdentifier(node) { @@ -417416,7 +418616,7 @@ var ts; } ts.skipConstraint = skipConstraint; function getNameFromPropertyName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ // treat computed property names where expression is string/numeric literal as just string/numeric literal ? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined : ts.isPrivateIdentifier(name) ? ts.idText(name) : ts.getTextOfIdentifierOrLiteral(name); @@ -417566,7 +418766,7 @@ var ts; ts.findModifier = findModifier; function insertImports(changes, sourceFile, imports, blankLineBetween) { var decl = ts.isArray(imports) ? imports[0] : imports; - var importKindPredicate = decl.kind === 237 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; + var importKindPredicate = decl.kind === 240 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; var existingImportStatements = ts.filter(sourceFile.statements, importKindPredicate); var sortedNewImports = ts.isArray(imports) ? ts.stableSort(imports, ts.OrganizeImports.compareImportsOrRequireStatements) : [imports]; if (!existingImportStatements.length) { @@ -418240,15 +419440,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checker.getContextualType(parent); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node); } - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -418278,8 +419478,8 @@ var ts; switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return true; default: return false; @@ -418313,38 +419513,38 @@ var ts; } ts.getTypeNodeIfAccessible = getTypeNodeIfAccessible; function syntaxRequiresTrailingCommaOrSemicolonOrASI(kind) { - return kind === 174 /* SyntaxKind.CallSignature */ - || kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */; + return kind === 176 /* SyntaxKind.CallSignature */ + || kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */; } function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) { - return kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 264 /* SyntaxKind.ModuleDeclaration */; } function syntaxRequiresTrailingSemicolonOrASI(kind) { - return kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.syntaxRequiresTrailingSemicolonOrASI = syntaxRequiresTrailingSemicolonOrASI; ts.syntaxMayBeASICandidate = ts.or(syntaxRequiresTrailingCommaOrSemicolonOrASI, syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI, syntaxRequiresTrailingModuleBlockOrSemicolonOrASI, syntaxRequiresTrailingSemicolonOrASI); @@ -418374,7 +419574,7 @@ var ts; return false; } // See comment in parser’s `parseDoStatement` - if (node.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.kind === 243 /* SyntaxKind.DoStatement */) { return true; } var topNode = ts.findAncestor(node, function (ancestor) { return !ancestor.parent; }); @@ -418863,6 +420063,10 @@ var ts; return jsx === 2 /* JsxEmit.React */ || jsx === 3 /* JsxEmit.ReactNative */; } ts.jsxModeNeedsExplicitImport = jsxModeNeedsExplicitImport; + function isSourceFileFromLibrary(program, node) { + return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node); + } + ts.isSourceFileFromLibrary = isSourceFileFromLibrary; // #endregion })(ts || (ts = {})); /*@internal*/ @@ -418978,14 +420182,16 @@ var ts; search: function (importingFile, preferCapitalized, matches, action) { if (importingFile !== usableByFileName) return; - exportInfo.forEach(function (info, key) { + return ts.forEachEntry(exportInfo, function (info, key) { var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName; var name = preferCapitalized && info[0].capitalizedSymbolName || symbolName; if (matches(name, info[0].targetFlags)) { var rehydrated = info.map(rehydrateCachedInfo); var filtered = rehydrated.filter(function (r, i) { return isNotShadowedByDeeperNodeModulesPackage(r, info[i].packageName); }); if (filtered.length) { - action(filtered, name, !!ambientModuleName, key); + var res = action(filtered, name, !!ambientModuleName, key); + if (res !== undefined) + return res; } } }); @@ -419373,11 +420579,11 @@ var ts; angleBracketStack--; } break; - case 130 /* SyntaxKind.AnyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -419566,10 +420772,11 @@ var ts; return true; } switch (keyword2) { - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: return true; // Allow things like "public get", "public constructor" and "public static". default: return false; // Any other keyword following "public" is actually an identifier, not a real keyword. @@ -419616,7 +420823,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: case 34 /* SyntaxKind.EqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: @@ -419712,13 +420920,13 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -419940,46 +421148,46 @@ var ts; pos = tag.tagName.end; var commentStart = tag.tagName.end; switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var param = tag; processJSDocParameterTag(param); commentStart = param.isNameFirst && ((_a = param.typeExpression) === null || _a === void 0 ? void 0 : _a.end) || param.name.end; break; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var prop = tag; commentStart = prop.isNameFirst && ((_b = prop.typeExpression) === null || _b === void 0 ? void 0 : _b.end) || prop.name.end; break; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: processJSDocTemplateTag(tag); pos = tag.end; commentStart = tag.typeParameters.end; break; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: var type = tag; - commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 309 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; + commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 312 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; break; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: commentStart = tag.typeExpression.end; break; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = tag.typeExpression.end; break; - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: commentStart = tag.typeExpression.end; break; - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_f = tag.typeExpression) === null || _f === void 0 ? void 0 : _f.end) || commentStart; break; - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: commentStart = ((_g = tag.name) === null || _g === void 0 ? void 0 : _g.end) || commentStart; break; - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: commentStart = tag.class.end; break; } @@ -420026,7 +421234,7 @@ var ts; // defined in `ts.commentPragmas` would be excessive, but we can avoid // some obvious false positives (e.g. in XML-like doc comments) by // checking the element name. - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!match[3] || !(match[3] in ts.commentPragmas)) { return false; } @@ -420136,22 +421344,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* ClassificationType.jsxOpenTagName */; } break; - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* ClassificationType.jsxCloseTagName */; } break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* ClassificationType.jsxSelfClosingTagName */; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: if (token.parent.name === token) { return 22 /* ClassificationType.jsxAttribute */; } @@ -420180,17 +421388,17 @@ var ts; var parent = token.parent; if (tokenKind === 63 /* SyntaxKind.EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 164 /* SyntaxKind.Parameter */ || - parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 166 /* SyntaxKind.Parameter */ || + parent.kind === 288 /* SyntaxKind.JsxAttribute */) { return 5 /* ClassificationType.operator */; } } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ || - parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || - parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */ || - parent.kind === 222 /* SyntaxKind.ConditionalExpression */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ || + parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || + parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */ || + parent.kind === 224 /* SyntaxKind.ConditionalExpression */) { return 5 /* ClassificationType.operator */; } } @@ -420203,7 +421411,7 @@ var ts; return 25 /* ClassificationType.bigintLiteral */; } else if (tokenKind === 10 /* SyntaxKind.StringLiteral */) { - return token && token.parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; + return token && token.parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; } else if (tokenKind === 13 /* SyntaxKind.RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -420219,32 +421427,32 @@ var ts; else if (tokenKind === 79 /* SyntaxKind.Identifier */) { if (token) { switch (token.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (token.parent.name === token) { return 11 /* ClassificationType.className */; } return; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: if (token.parent.name === token) { return 15 /* ClassificationType.typeParameterName */; } return; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* ClassificationType.interfaceName */; } return; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (token.parent.name === token) { return 12 /* ClassificationType.enumName */; } return; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (token.parent.name === token) { return 14 /* ClassificationType.moduleName */; } return; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* ClassificationType.keyword */ : 17 /* ClassificationType.parameterName */; } @@ -420349,13 +421557,13 @@ var ts; var inJSXElement = false; function visit(node) { switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!node || !ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { @@ -420395,7 +421603,7 @@ var ts; if (modifiers & 32 /* ModifierFlags.Static */) { modifierSet |= 1 << 1 /* TokenModifier.static */; } - if (modifiers & 256 /* ModifierFlags.Async */) { + if (modifiers & 512 /* ModifierFlags.Async */) { modifierSet |= 1 << 2 /* TokenModifier.async */; } if (typeIdx !== 0 /* TokenType.class */ && typeIdx !== 2 /* TokenType.interface */) { @@ -420501,25 +421709,25 @@ var ts; return (ts.isQualifiedName(node.parent) && node.parent.right === node) || (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node); } var tokenFromDeclarationMapping = new ts.Map([ - [254 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], - [164 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], - [167 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], - [261 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], - [260 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], - [299 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], - [257 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], - [169 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], - [256 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], - [213 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], - [168 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], - [172 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], - [173 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], - [166 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], - [258 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], - [259 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], - [163 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], - [296 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], - [297 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] + [257 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], + [166 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], + [169 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], + [264 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], + [263 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], + [302 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], + [260 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], + [171 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], + [259 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], + [215 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], + [170 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], + [174 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], + [175 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], + [168 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], + [261 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], + [262 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], + [165 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], + [299 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], + [300 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] ]); })(v2020 = classifier.v2020 || (classifier.v2020 = {})); })(classifier = ts.classifier || (ts.classifier = {})); @@ -420653,18 +421861,18 @@ var ts; function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) { var parent = walkUpParentheses(node.parent); switch (parent.kind) { - case 196 /* SyntaxKind.LiteralType */: { + case 198 /* SyntaxKind.LiteralType */: { var grandParent_1 = walkUpParentheses(parent.parent); switch (grandParent_1.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: { var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === grandParent_1; }); if (typeArgument) { return { kind: 2 /* StringLiteralCompletionKind.Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; } return undefined; } - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { // foo: string; @@ -420676,9 +421884,9 @@ var ts; return undefined; } return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return { kind: 0 /* StringLiteralCompletionKind.Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; - case 187 /* SyntaxKind.UnionType */: { + case 189 /* SyntaxKind.UnionType */: { if (!ts.isTypeReferenceNode(grandParent_1.parent)) { return undefined; } @@ -420690,7 +421898,7 @@ var ts; return undefined; } } - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -420707,7 +421915,7 @@ var ts; return stringLiteralCompletionsForObjectLiteral(typeChecker, parent.parent); } return fromContextualType(); - case 207 /* SyntaxKind.ElementAccessExpression */: { + case 209 /* SyntaxKind.ElementAccessExpression */: { var _b = parent, expression = _b.expression, argumentExpression = _b.argumentExpression; if (node === ts.skipParentheses(argumentExpression)) { // Get all names of properties on the expression @@ -420720,20 +421928,20 @@ var ts; } return undefined; } - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 285 /* SyntaxKind.JsxAttribute */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 288 /* SyntaxKind.JsxAttribute */: if (!isRequireCallArgument(node) && !ts.isImportCall(parent)) { - var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); + var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) : fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); } // falls through (is `require("")` or `require(""` or `import("")`) - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 277 /* SyntaxKind.ExternalModuleReference */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 280 /* SyntaxKind.ExternalModuleReference */: // Get all known external module names or complete a path to a module // i.e. import * as ns from "/*completion position*/"; // var y = import("/*completion position*/"); @@ -420752,9 +421960,9 @@ var ts; } function walkUpParentheses(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return ts.walkUpParenthesizedTypes(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return ts.walkUpParenthesizedExpressions(node); default: return node; @@ -420784,7 +421992,7 @@ var ts; isNewIdentifier = isNewIdentifier || !!(type.flags & 4 /* TypeFlags.String */); return getStringLiteralTypes(type, uniques); }); - return { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier }; + return ts.length(types) ? { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier } : undefined; } function stringLiteralCompletionsFromProperties(type) { return type && { @@ -421302,7 +422510,7 @@ var ts; if (!dependencies) continue; for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) { result.push(dep); } } @@ -421677,7 +422885,7 @@ var ts; } function keywordFiltersFromSyntaxKind(keywordCompletion) { switch (keywordCompletion) { - case 152 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; + case 154 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; default: ts.Debug.fail("Unknown mapping from SyntaxKind to KeywordCompletionFilters"); } } @@ -421686,7 +422894,7 @@ var ts; return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined; } function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) { - var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; + var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; // Verify if the file is JSX language variant if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) { var completionInfo = getJsxClosingTagCompletion(location, sourceFile); @@ -421700,7 +422908,7 @@ var ts; return undefined; } var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, - /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); + /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) { for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) { var keywordEntry = _a[_i]; @@ -421753,12 +422961,12 @@ var ts; // We wanna walk up the tree till we find a JSX closing element var jsxClosingElement = ts.findAncestor(location, function (node) { switch (node.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: return true; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return false; default: return "quit"; @@ -421818,7 +423026,7 @@ var ts; function createCompletionEntryForLiteral(sourceFile, preferences, literal) { return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority }; } - function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { + function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { var _a, _b; var insertText; var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken); @@ -421874,8 +423082,8 @@ var ts; } if (originIsResolvedExport(origin)) { sourceDisplay = [ts.textPart(origin.moduleSpecifier)]; - if (importCompletionNode) { - (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); + if (importStatementCompletion) { + (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined; } } @@ -421885,7 +423093,7 @@ var ts; if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* CompletionKind.MemberLike */ && - isClassLikeMemberCompletion(symbol, location)) { + isClassLikeMemberCompletion(symbol, location, sourceFile)) { var importAdder = void 0; (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan); sortText = Completions.SortText.ClassMemberSnippets; // sortText has to be lower priority than the sortText for keywords. See #47852. @@ -421930,7 +423138,7 @@ var ts; } if (originIsExport(origin) || originIsResolvedExport(origin)) { data = originToCompletionEntryData(origin); - hasAction = !importCompletionNode; + hasAction = !importStatementCompletion; } // TODO(drosen): Right now we just permit *all* semantic meanings when calling // 'getSymbolKind' which is permissible given that it is backwards compatible; but @@ -421953,11 +423161,11 @@ var ts; labelDetails: labelDetails, isSnippet: isSnippet, isPackageJsonImport: originIsPackageJsonImport(origin) || undefined, - isImportStatementCompletion: !!importCompletionNode || undefined, + isImportStatementCompletion: !!importStatementCompletion || undefined, data: data, }; } - function isClassLikeMemberCompletion(symbol, location) { + function isClassLikeMemberCompletion(symbol, location, sourceFile) { // TODO: support JS files. if (ts.isInJSFile(location)) { return false; @@ -421991,6 +423199,7 @@ var ts; location.parent.parent && ts.isClassElement(location.parent) && location === location.parent.name && + location.parent.getLastToken(sourceFile) === location.parent.name && ts.isClassLike(location.parent.parent)) || (location.parent && ts.isSyntaxList(location) && @@ -422032,7 +423241,7 @@ var ts; // Whether the suggested member should be abstract. // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`. var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span; - var isAbstract = !!(presentModifiers & 128 /* ModifierFlags.Abstract */); + var isAbstract = !!(presentModifiers & 256 /* ModifierFlags.Abstract */); var completionNodes = []; ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder, // `addNewNodeForMemberSymbol` calls this callback function for each new member node @@ -422045,7 +423254,7 @@ var ts; function (node) { var requiredModifiers = 0 /* ModifierFlags.None */; if (isAbstract) { - requiredModifiers |= 128 /* ModifierFlags.Abstract */; + requiredModifiers |= 256 /* ModifierFlags.Abstract */; } if (ts.isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* MemberOverrideStatus.NeedsOverride */) { @@ -422106,7 +423315,7 @@ var ts; span = ts.createTextSpanFromNode(contextToken); } if (ts.isPropertyDeclaration(contextToken.parent)) { - modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 125951 /* ModifierFlags.Modifier */; + modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 126975 /* ModifierFlags.Modifier */; span = ts.createTextSpanFromNode(contextToken.parent); } return { modifiers: modifiers, span: span }; @@ -422155,7 +423364,6 @@ var ts; var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) }; return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails }; } - ; function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) { var declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { @@ -422168,10 +423376,10 @@ var ts; var quotePreference = ts.getQuotePreference(sourceFile, preferences); var builderFlags = 33554432 /* NodeBuilderFlags.OmitThisParameter */ | (quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : 0 /* NodeBuilderFlags.None */); switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: { var effectiveType = type.flags & 1048576 /* TypeFlags.Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* UnionReduction.Subtype */) : type; @@ -422205,7 +423413,8 @@ var ts; } var parameters = typeNode.parameters.map(function (typedParam) { return ts.factory.createParameterDeclaration( - /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken, + /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, + /*questionToken*/ undefined, /*type*/ undefined, typedParam.initializer); }); return ts.factory.createMethodDeclaration( @@ -422325,20 +423534,17 @@ var ts; }; return unresolvedOrigin; } - function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) { - var _a, _b, _c; - var sourceFile = importCompletionNode.getSourceFile(); - var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile); + function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) { + var replacementSpan = importStatementCompletion.replacementSpan; var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ : origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ : 0 /* ExportKind.Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true); - var isTopLevelTypeOnly = ((_b = (_a = ts.tryCast(importCompletionNode, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || ((_c = ts.tryCast(importCompletionNode, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly); - var isImportSpecifierTypeOnly = couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); - var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : " "; - var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : ""; + var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier; + var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " "; + var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : ""; var suffix = useSemicolons ? ";" : ""; switch (importKind) { case 3 /* ImportKind.CommonJS */: return { replacementSpan: replacementSpan, insertText: "import".concat(topLevelTypeOnlyText).concat(ts.escapeSnippetText(name)).concat(tabStop, " = require(").concat(quotedModuleSpecifier, ")").concat(suffix) }; @@ -422371,7 +423577,7 @@ var ts; return CompletionSource.TypeOnlyAlias; } } - function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { + function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { var _a; var start = ts.timestamp(); var variableDeclaration = getVariableDeclaration(location); @@ -422392,7 +423598,7 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority; var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText); - var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); + var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); if (!entry) { continue; } @@ -422552,7 +423758,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217 } case "literal": { @@ -422581,9 +423787,9 @@ var ts; return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source }; } Completions.createCompletionDetails = createCompletionDetails; - function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) { + function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) { if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) { - if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) { + if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) { // Import statement completion: 'import c|' return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] }; } @@ -422613,7 +423819,7 @@ var ts; var moduleSymbol = origin.moduleSymbol; var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker)); var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* SyntaxKind.LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent); - var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; + var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences, cancellationToken), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier); return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } @@ -422656,11 +423862,11 @@ var ts; return ts.getContextualTypeFromParent(previousToken, checker); case 63 /* SyntaxKind.EqualsToken */: switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.getContextualType(parent.initializer); // TODO: GH#18217 - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -422691,7 +423897,7 @@ var ts; } function isModuleSymbol(symbol) { var _a; - return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 305 /* SyntaxKind.SourceFile */; })); + return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 308 /* SyntaxKind.SourceFile */; })); } function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) { var typeChecker = program.getTypeChecker(); @@ -422748,7 +423954,7 @@ var ts; currentToken = ts.getTokenAtPosition(sourceFile, position); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 347 /* SyntaxKind.JSDocPropertyTag */ || + (currentToken.parent.kind !== 350 /* SyntaxKind.JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression); @@ -422784,34 +423990,34 @@ var ts; var isStartingCloseTag = false; var isJsxInitializer = false; var isJsxIdentifierExpected = false; - var importCompletionNode; + var importStatementCompletion; var location = ts.getTouchingPropertyName(sourceFile, position); var keywordFilters = 0 /* KeywordCompletionFilters.None */; var isNewIdentifierLocation = false; var flags = 0 /* CompletionInfoFlags.None */; if (contextToken) { - var importStatementCompletion = getImportStatementCompletionInfo(contextToken); - isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation; - if (importStatementCompletion.keywordCompletion) { - if (importStatementCompletion.isKeywordOnlyCompletion) { + var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken); + if (importStatementCompletionInfo.keywordCompletion) { + if (importStatementCompletionInfo.isKeywordOnlyCompletion) { return { kind: 4 /* CompletionDataKind.Keywords */, - keywordCompletions: [keywordToCompletionEntry(importStatementCompletion.keywordCompletion)], - isNewIdentifierLocation: isNewIdentifierLocation, + keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)], + isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation, }; } - keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletion.keywordCompletion); + keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion); } - if (importStatementCompletion.replacementNode && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = importStatementCompletion.replacementNode; flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */; + importStatementCompletion = importStatementCompletionInfo; + isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation; } // Bail out if this is a known invalid completion location - if (!importCompletionNode && isCompletionListBlocker(contextToken)) { + if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation()) @@ -422822,7 +424028,7 @@ var ts; isRightOfDot = contextToken.kind === 24 /* SyntaxKind.DotToken */; isRightOfQuestionDot = contextToken.kind === 28 /* SyntaxKind.QuestionDotToken */; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); @@ -422838,16 +424044,16 @@ var ts; return undefined; } break; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: node = parent.left; break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: node = parent.name; break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: node = parent; break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: node = parent.getFirstToken(sourceFile); ts.Debug.assert(node.kind === 100 /* SyntaxKind.ImportKeyword */ || node.kind === 103 /* SyntaxKind.NewKeyword */); break; @@ -422857,11 +424063,11 @@ var ts; return undefined; } } - else if (!importCompletionNode && sourceFile.languageVariant === 1 /* LanguageVariant.JSX */) { + else if (!importStatementCompletion) { // // If the tagname is a property access expression, we will then walk up to the top most of property access expression. // Then, try to get a JSX container and its associated attributes type. - if (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -422869,46 +424075,46 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 31 /* SyntaxKind.GreaterThanToken */: - if (currentToken.parent.kind === 278 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (currentToken.parent.kind === 281 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { location = currentToken; } break; case 43 /* SyntaxKind.SlashToken */: - if (currentToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { + if (currentToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (contextToken.kind === 43 /* SyntaxKind.SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (!binaryExpressionMayBeOpenTag(parent)) { break; } // falls through - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: isJsxIdentifierExpected = true; if (contextToken.kind === 29 /* SyntaxKind.LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: // For `
`, `parent` will be `{true}` and `previousToken` will be `}` if (previousToken.kind === 19 /* SyntaxKind.CloseBraceToken */ && currentToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { isJsxIdentifierExpected = true; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: // For `
`, `parent` will be JsxAttribute and `previousToken` will be its initializer if (parent.initializer === previousToken && previousToken.end < position) { @@ -423000,19 +424206,19 @@ var ts; isTypeOnlyLocation: isTypeOnlyLocation, isJsxIdentifierExpected: isJsxIdentifierExpected, isRightOfOpenTag: isRightOfOpenTag, - importCompletionNode: importCompletionNode, + importStatementCompletion: importStatementCompletion, hasUnresolvedAutoImports: hasUnresolvedAutoImports, flags: flags, }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return true; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return !!tag.constraint; default: return false; @@ -423021,7 +424227,7 @@ var ts; function tryGetTypeExpressionFromTag(tag) { if (isTagWithTypeExpression(tag)) { var typeExpression = ts.isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression; - return typeExpression && typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; + return typeExpression && typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; } return undefined; } @@ -423064,7 +424270,7 @@ var ts; // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). if (!isTypeLocation && symbol.declarations && - symbol.declarations.some(function (d) { return d.kind !== 305 /* SyntaxKind.SourceFile */ && d.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 260 /* SyntaxKind.EnumDeclaration */; })) { + symbol.declarations.some(function (d) { return d.kind !== 308 /* SyntaxKind.SourceFile */ && d.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 263 /* SyntaxKind.EnumDeclaration */; })) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType(); var insertQuestionDot = false; if (type.isNullableType()) { @@ -423110,7 +424316,7 @@ var ts; if (isRightOfQuestionDot && ts.some(type.getCallSignatures())) { isNewIdentifierLocation = true; } - var propertyAccess = node.kind === 200 /* SyntaxKind.ImportType */ ? node : node.parent; + var propertyAccess = node.kind === 202 /* SyntaxKind.ImportType */ ? node : node.parent; if (inCheckedFile) { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; @@ -423254,7 +424460,7 @@ var ts; return 1 /* GlobalsSearch.Success */; } function tryGetImportCompletionSymbols() { - if (!importCompletionNode) + if (!importStatementCompletion) return 0 /* GlobalsSearch.Continue */; isNewIdentifierLocation = true; collectAutoImports(); @@ -423317,7 +424523,7 @@ var ts; } } // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 305 /* SyntaxKind.SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 308 /* SyntaxKind.SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false, ts.isClassLike(scopeNode.parent) ? scopeNode : undefined); if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) { @@ -423337,7 +424543,7 @@ var ts; } function shouldOfferImportCompletions() { // If already typing an import statement, provide completions for it. - if (importCompletionNode) + if (importStatementCompletion) return true; // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols if (isNonContextualObjectLiteral) @@ -423356,10 +424562,10 @@ var ts; } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 223 /* SyntaxKind.TemplateExpression */: - case 288 /* SyntaxKind.JsxExpression */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 225 /* SyntaxKind.TemplateExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 238 /* SyntaxKind.Block */: return true; default: return ts.isStatement(scopeNode); @@ -423367,7 +424573,7 @@ var ts; } function isTypeOnlyCompletion() { return insideJsDocTagTypeExpression - || !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent) + || !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || ts.isPartOfTypeNode(location) @@ -423376,28 +424582,30 @@ var ts; function isContextTokenValueLocation(contextToken) { return contextToken && ((contextToken.kind === 112 /* SyntaxKind.TypeOfKeyword */ && - (contextToken.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || - (contextToken.kind === 128 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 177 /* SyntaxKind.TypePredicate */)); + (contextToken.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || + (contextToken.kind === 129 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 179 /* SyntaxKind.TypePredicate */)); } function isContextTokenTypeLocation(contextToken) { if (contextToken) { var parentKind = contextToken.parent.kind; switch (contextToken.kind) { case 58 /* SyntaxKind.ColonToken */: - return parentKind === 167 /* SyntaxKind.PropertyDeclaration */ || - parentKind === 166 /* SyntaxKind.PropertySignature */ || - parentKind === 164 /* SyntaxKind.Parameter */ || - parentKind === 254 /* SyntaxKind.VariableDeclaration */ || + return parentKind === 169 /* SyntaxKind.PropertyDeclaration */ || + parentKind === 168 /* SyntaxKind.PropertySignature */ || + parentKind === 166 /* SyntaxKind.Parameter */ || + parentKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); case 63 /* SyntaxKind.EqualsToken */: - return parentKind === 259 /* SyntaxKind.TypeAliasDeclaration */; - case 127 /* SyntaxKind.AsKeyword */: - return parentKind === 229 /* SyntaxKind.AsExpression */; + return parentKind === 262 /* SyntaxKind.TypeAliasDeclaration */; + case 128 /* SyntaxKind.AsKeyword */: + return parentKind === 231 /* SyntaxKind.AsExpression */; case 29 /* SyntaxKind.LessThanToken */: - return parentKind === 178 /* SyntaxKind.TypeReference */ || - parentKind === 211 /* SyntaxKind.TypeAssertionExpression */; + return parentKind === 180 /* SyntaxKind.TypeReference */ || + parentKind === 213 /* SyntaxKind.TypeAssertionExpression */; case 94 /* SyntaxKind.ExtendsKeyword */: - return parentKind === 163 /* SyntaxKind.TypeParameter */; + return parentKind === 165 /* SyntaxKind.TypeParameter */; + case 150 /* SyntaxKind.SatisfiesKeyword */: + return parentKind === 235 /* SyntaxKind.SatisfiesExpression */; } } return false; @@ -423415,8 +424623,7 @@ var ts; flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */; // import { type | -> token text should be blank var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken - && importCompletionNode - && couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); + && importStatementCompletion; var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() : ""; @@ -423424,14 +424631,14 @@ var ts; var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken); var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host); var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host); - resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) { + resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) { exportInfo.search(sourceFile.path, /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) { if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings()))) return false; if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName)) return false; - if (!isTypeOnlyLocation && !importCompletionNode && !(targetFlags & 111551 /* SymbolFlags.Value */)) + if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */)) return false; if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */))) return false; @@ -423512,7 +424719,7 @@ var ts; return; } symbolToOriginInfoMap[symbols.length] = origin; - symbolToSortTextMap[symbolId] = importCompletionNode ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; + symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; symbols.push(symbol); } /* Mutates `symbols` and `symbolToOriginInfoMap`. */ @@ -423588,18 +424795,18 @@ var ts; // - contextToken: GreaterThanToken (before cursor) // - location: JsxSelfClosingElement or JsxOpeningElement // - contextToken.parent === location - if (location === contextToken.parent && (location.kind === 280 /* SyntaxKind.JsxOpeningElement */ || location.kind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (location === contextToken.parent && (location.kind === 283 /* SyntaxKind.JsxOpeningElement */ || location.kind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { return false; } - if (contextToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (contextToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { //
/**/ // - contextToken: GreaterThanToken (before cursor) // - location: JSXElement // - different parents (JSXOpeningElement, JSXElement) - return location.parent.kind !== 280 /* SyntaxKind.JsxOpeningElement */; + return location.parent.kind !== 283 /* SyntaxKind.JsxOpeningElement */; } - if (contextToken.parent.kind === 281 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { - return !!contextToken.parent.parent && contextToken.parent.parent.kind === 278 /* SyntaxKind.JsxElement */; + if (contextToken.parent.kind === 284 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { + return !!contextToken.parent.parent && contextToken.parent.parent.kind === 281 /* SyntaxKind.JsxElement */; } } return false; @@ -423611,44 +424818,44 @@ var ts; // Previous token may have been a keyword that was converted to an identifier. switch (tokenKind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( a, | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a, | - || containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [a, | - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */ // const x = (a, | - || containingNodeKind === 179 /* SyntaxKind.FunctionType */ // var x: (s: string, list| - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( a, | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a, | + || containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [a, | + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */ // const x = (a, | + || containingNodeKind === 181 /* SyntaxKind.FunctionType */ // var x: (s: string, list| + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( | - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a| - || containingNodeKind === 212 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 191 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( | + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a| + || containingNodeKind === 214 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 193 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [ | - || containingNodeKind === 176 /* SyntaxKind.IndexSignature */ // [ | : string ] - || containingNodeKind === 162 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ - case 141 /* SyntaxKind.ModuleKeyword */: // module | - case 142 /* SyntaxKind.NamespaceKeyword */: // namespace | + return containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [ | + || containingNodeKind === 178 /* SyntaxKind.IndexSignature */ // [ | : string ] + || containingNodeKind === 164 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ + case 142 /* SyntaxKind.ModuleKeyword */: // module | + case 143 /* SyntaxKind.NamespaceKeyword */: // namespace | case 100 /* SyntaxKind.ImportKeyword */: // import | return true; case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 261 /* SyntaxKind.ModuleDeclaration */; // module A.| + return containingNodeKind === 264 /* SyntaxKind.ModuleDeclaration */; // module A.| case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ // class A { | - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ // class A { | + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | case 63 /* SyntaxKind.EqualsToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ // const x = a| - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */; // x = a| + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ // const x = a| + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */; // x = a| case 15 /* SyntaxKind.TemplateHead */: - return containingNodeKind === 223 /* SyntaxKind.TemplateExpression */; // `aa ${| + return containingNodeKind === 225 /* SyntaxKind.TemplateExpression */; // `aa ${| case 16 /* SyntaxKind.TemplateMiddle */: - return containingNodeKind === 233 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| - case 131 /* SyntaxKind.AsyncKeyword */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() - || containingNodeKind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| + return containingNodeKind === 236 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| + case 132 /* SyntaxKind.AsyncKeyword */: + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() + || containingNodeKind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| case 41 /* SyntaxKind.AsteriskToken */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| } if (isClassMemberCompletionKeyword(tokenKind)) { return true; @@ -423698,7 +424905,7 @@ var ts; completionKind = 0 /* CompletionKind.ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { var instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); // Check completions for Object property value shorthand if (instantiatedType === undefined) { @@ -423723,7 +424930,7 @@ var ts; } } else { - ts.Debug.assert(objectLikeContainer.kind === 201 /* SyntaxKind.ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 203 /* SyntaxKind.ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -423734,12 +424941,12 @@ var ts; // through type declaration or inference. // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function - var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */; - if (!canGetType && rootDeclaration.kind === 164 /* SyntaxKind.Parameter */) { + var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */; + if (!canGetType && rootDeclaration.kind === 166 /* SyntaxKind.Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (rootDeclaration.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 175 /* SyntaxKind.SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -423758,7 +424965,7 @@ var ts; var filteredMembers = filterObjectMembersList(typeMembers, ts.Debug.checkDefined(existingMembers)); symbols = ts.concatenate(symbols, filteredMembers); setSortTextToOptionalMember(); - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { transformObjectLiteralMembersSortText(symbolsStartIndex); @@ -423793,10 +425000,10 @@ var ts; keywordFilters = 8 /* KeywordCompletionFilters.TypeKeyword */; } // try to show exported member for imported/re-exported module - var moduleSpecifier = (namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; + var moduleSpecifier = (namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; if (!moduleSpecifier) { isNewIdentifierLocation = true; - return namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; + return namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; } var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217 if (!moduleSpecifierSymbol) { @@ -423941,11 +425148,11 @@ var ts; case 30 /* SyntaxKind.LessThanSlashToken */: case 43 /* SyntaxKind.SlashToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 286 /* SyntaxKind.JsxAttributes */: - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - if (parent && (parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 280 /* SyntaxKind.JsxOpeningElement */)) { + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 289 /* SyntaxKind.JsxAttributes */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + if (parent && (parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 283 /* SyntaxKind.JsxOpeningElement */)) { if (contextToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined); if (!parent.typeArguments || (precedingToken && precedingToken.kind === 43 /* SyntaxKind.SlashToken */)) @@ -423953,7 +425160,7 @@ var ts; } return parent; } - else if (parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + else if (parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -423965,7 +425172,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 10 /* SyntaxKind.StringLiteral */: - if (parent && ((parent.kind === 285 /* SyntaxKind.JsxAttribute */) || (parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 288 /* SyntaxKind.JsxAttribute */) || (parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -423975,8 +425182,8 @@ var ts; break; case 19 /* SyntaxKind.CloseBraceToken */: if (parent && - parent.kind === 288 /* SyntaxKind.JsxExpression */ && - parent.parent && parent.parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + parent.kind === 291 /* SyntaxKind.JsxExpression */ && + parent.parent && parent.parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -423984,7 +425191,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (parent && parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -424004,54 +425211,54 @@ var ts; var containingNodeKind = parent.kind; switch (contextToken.kind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ || + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken) || - containingNodeKind === 237 /* SyntaxKind.VariableStatement */ || - containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | + containingNodeKind === 240 /* SyntaxKind.VariableStatement */ || + containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A= contextToken.pos); case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [.| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [.| case 58 /* SyntaxKind.ColonToken */: - return containingNodeKind === 203 /* SyntaxKind.BindingElement */; // var {x :html| + return containingNodeKind === 205 /* SyntaxKind.BindingElement */; // var {x :html| case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [x| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [x| case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 292 /* SyntaxKind.CatchClause */ || + return containingNodeKind === 295 /* SyntaxKind.CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */; // enum a { | + return containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */; // enum a { | case 29 /* SyntaxKind.LessThanToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ || // class A< | - containingNodeKind === 226 /* SyntaxKind.ClassExpression */ || // var C = class D< | - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | - containingNodeKind === 259 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ || // class A< | + containingNodeKind === 228 /* SyntaxKind.ClassExpression */ || // var C = class D< | + containingNodeKind === 261 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | + containingNodeKind === 262 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); case 124 /* SyntaxKind.StaticKeyword */: - return containingNodeKind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); + return containingNodeKind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); case 25 /* SyntaxKind.DotDotDotToken */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ || - (!!parent.parent && parent.parent.kind === 202 /* SyntaxKind.ArrayBindingPattern */); // var [...z| + return containingNodeKind === 166 /* SyntaxKind.Parameter */ || + (!!parent.parent && parent.parent.kind === 204 /* SyntaxKind.ArrayBindingPattern */); // var [...z| case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); - case 127 /* SyntaxKind.AsKeyword */: - return containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ || - containingNodeKind === 275 /* SyntaxKind.ExportSpecifier */ || - containingNodeKind === 268 /* SyntaxKind.NamespaceImport */; - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + return containingNodeKind === 166 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); + case 128 /* SyntaxKind.AsKeyword */: + return containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ || + containingNodeKind === 278 /* SyntaxKind.ExportSpecifier */ || + containingNodeKind === 271 /* SyntaxKind.NamespaceImport */; + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: return !isFromObjectTypeDeclaration(contextToken); case 79 /* SyntaxKind.Identifier */: - if (containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ && + if (containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ && contextToken === parent.name && contextToken.text === "type") { // import { type | } @@ -424066,11 +425273,11 @@ var ts; case 100 /* SyntaxKind.ImportKeyword */: case 119 /* SyntaxKind.LetKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return true; - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: // import { type foo| } - return containingNodeKind !== 270 /* SyntaxKind.ImportSpecifier */; + return containingNodeKind !== 273 /* SyntaxKind.ImportSpecifier */; case 41 /* SyntaxKind.AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); } @@ -424095,7 +425302,7 @@ var ts; case 126 /* SyntaxKind.AbstractKeyword */: case 84 /* SyntaxKind.ClassKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 98 /* SyntaxKind.FunctionKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: @@ -424106,7 +425313,7 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: case 113 /* SyntaxKind.VarKeyword */: return true; - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return ts.isPropertyDeclaration(contextToken.parent); } // If we are inside a class declaration, and `constructor` is totally not present, @@ -424115,7 +425322,7 @@ var ts; if (ancestorClassLike && contextToken === previousToken && isPreviousPropertyDeclarationTerminated(contextToken, position)) { return false; // Don't block completions. } - var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 167 /* SyntaxKind.PropertyDeclaration */); + var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 169 /* SyntaxKind.PropertyDeclaration */); // If we are inside a class declaration and typing `constructor` after property declaration... if (ancestorPropertyDeclaraion && contextToken !== previousToken @@ -424147,7 +425354,7 @@ var ts; || !ts.positionsAreOnSameLine(contextToken.end, position, sourceFile)); } function isFunctionLikeButNotConstructor(kind) { - return ts.isFunctionLikeKind(kind) && kind !== 171 /* SyntaxKind.Constructor */; + return ts.isFunctionLikeKind(kind) && kind !== 173 /* SyntaxKind.Constructor */; } function isDotOfNumericLiteral(contextToken) { if (contextToken.kind === 8 /* SyntaxKind.NumericLiteral */) { @@ -424157,7 +425364,7 @@ var ts; return false; } function isVariableDeclarationListButNotTypeArgument(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && !ts.isPossiblyTypeArgumentPosition(node, sourceFile, typeChecker); } /** @@ -424175,13 +425382,13 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 296 /* SyntaxKind.PropertyAssignment */ && - m.kind !== 297 /* SyntaxKind.ShorthandPropertyAssignment */ && - m.kind !== 203 /* SyntaxKind.BindingElement */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */ && - m.kind !== 298 /* SyntaxKind.SpreadAssignment */) { + if (m.kind !== 299 /* SyntaxKind.PropertyAssignment */ && + m.kind !== 300 /* SyntaxKind.ShorthandPropertyAssignment */ && + m.kind !== 205 /* SyntaxKind.BindingElement */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */ && + m.kind !== 301 /* SyntaxKind.SpreadAssignment */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -424272,10 +425479,10 @@ var ts; for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { var m = existingMembers_2[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (m.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -424317,7 +425524,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (attr.kind === 288 /* SyntaxKind.JsxAttribute */) { seenNames.add(attr.name.escapedText); } else if (ts.isJsxSpreadAttribute(attr)) { @@ -424415,7 +425622,7 @@ var ts; var _keywordCompletions = []; var allKeywordsCompletions = ts.memoize(function () { var res = []; - for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 160 /* SyntaxKind.LastKeyword */; i++) { + for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 162 /* SyntaxKind.LastKeyword */; i++) { res.push({ name: ts.tokenToString(i), kind: "keyword" /* ScriptElementKind.keyword */, @@ -424441,12 +425648,12 @@ var ts; return false; case 1 /* KeywordCompletionFilters.All */: return isFunctionLikeBodyKeyword(kind) - || kind === 135 /* SyntaxKind.DeclareKeyword */ - || kind === 141 /* SyntaxKind.ModuleKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ - || kind === 142 /* SyntaxKind.NamespaceKeyword */ + || kind === 136 /* SyntaxKind.DeclareKeyword */ + || kind === 142 /* SyntaxKind.ModuleKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ + || kind === 143 /* SyntaxKind.NamespaceKeyword */ || kind === 126 /* SyntaxKind.AbstractKeyword */ - || ts.isTypeKeyword(kind) && kind !== 153 /* SyntaxKind.UndefinedKeyword */; + || ts.isTypeKeyword(kind) && kind !== 155 /* SyntaxKind.UndefinedKeyword */; case 5 /* KeywordCompletionFilters.FunctionLikeBodyKeywords */: return isFunctionLikeBodyKeyword(kind); case 2 /* KeywordCompletionFilters.ClassElementKeywords */: @@ -424460,7 +425667,7 @@ var ts; case 7 /* KeywordCompletionFilters.TypeKeywords */: return ts.isTypeKeyword(kind); case 8 /* KeywordCompletionFilters.TypeKeyword */: - return kind === 152 /* SyntaxKind.TypeKeyword */; + return kind === 154 /* SyntaxKind.TypeKeyword */; default: return ts.Debug.assertNever(keywordFilter); } @@ -424469,59 +425676,61 @@ var ts; function isTypeScriptOnlyKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: case 117 /* SyntaxKind.ImplementsKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 139 /* SyntaxKind.IsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 140 /* SyntaxKind.IsKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return true; default: return false; } } function isInterfaceOrTypeLiteralCompletionKeyword(kind) { - return kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return kind === 146 /* SyntaxKind.ReadonlyKeyword */; } function isClassMemberCompletionKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; default: return ts.isClassMemberModifier(kind); } } function isFunctionLikeBodyKeyword(kind) { - return kind === 131 /* SyntaxKind.AsyncKeyword */ - || kind === 132 /* SyntaxKind.AwaitKeyword */ - || kind === 127 /* SyntaxKind.AsKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ + return kind === 132 /* SyntaxKind.AsyncKeyword */ + || kind === 133 /* SyntaxKind.AwaitKeyword */ + || kind === 128 /* SyntaxKind.AsKeyword */ + || kind === 150 /* SyntaxKind.SatisfiesKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node) { @@ -424546,7 +425755,7 @@ var ts; && contextToken === parent.moduleSpecifier && tokenLine === currentLine) { entries.push({ - name: ts.tokenToString(129 /* SyntaxKind.AssertKeyword */), + name: ts.tokenToString(130 /* SyntaxKind.AssertKeyword */), kind: "keyword" /* ScriptElementKind.keyword */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.GlobalsOrKeywords, @@ -424612,7 +425821,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) { // class c { method() { } | method2() { } } switch (location.kind) { - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* SyntaxKind.EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -424638,7 +425847,7 @@ var ts; if (!contextToken) return undefined; // class C { blah; constructor/**/ } and so on - if (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ + if (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ // class C { blah \n constructor/**/ } || (ts.isIdentifier(contextToken) && ts.isPropertyDeclaration(contextToken.parent) && ts.isClassLike(location))) { return ts.findAncestor(contextToken, ts.isClassLike); @@ -424681,7 +425890,7 @@ var ts; case 26 /* SyntaxKind.SemicolonToken */: case 27 /* SyntaxKind.CommaToken */: case 79 /* SyntaxKind.Identifier */: - if (parent.kind === 166 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { + if (parent.kind === 168 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { return parent.parent; } break; @@ -424698,11 +425907,11 @@ var ts; if (!t) return undefined; switch (node.kind) { - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); - case 188 /* SyntaxKind.IntersectionType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 189 /* SyntaxKind.UnionType */: return t; } } @@ -424730,7 +425939,7 @@ var ts; ? !!ts.tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 43 /* SyntaxKind.SlashToken */ && ts.isJsxClosingElement(contextToken.parent)); case " ": - return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 305 /* SyntaxKind.SourceFile */; + return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SyntaxKind.SourceFile */; default: return ts.Debug.assertNever(triggerCharacter); } @@ -424777,21 +425986,22 @@ var ts; return undefined; } function getImportStatementCompletionInfo(contextToken) { + var _a, _b, _c; var keywordCompletion; var isKeywordOnlyCompletion = false; var candidate = getCandidate(); return { isKeywordOnlyCompletion: isKeywordOnlyCompletion, keywordCompletion: keywordCompletion, - isNewIdentifierLocation: !!(candidate || keywordCompletion === 152 /* SyntaxKind.TypeKeyword */), - replacementNode: candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) - ? candidate - : undefined + isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */), + isTopLevelTypeOnly: !!((_b = (_a = ts.tryCast(candidate, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts.tryCast(candidate, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly), + couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken), + replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate), }; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { - keywordCompletion = contextToken.kind === 152 /* SyntaxKind.TypeKeyword */ ? undefined : 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = contextToken.kind === 154 /* SyntaxKind.TypeKeyword */ ? undefined : 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (couldBeTypeOnlyImportSpecifier(parent, contextToken) && canCompleteFromNamedBindings(parent.parent)) { @@ -424801,13 +426011,13 @@ var ts; if (!parent.parent.isTypeOnly && (contextToken.kind === 18 /* SyntaxKind.OpenBraceToken */ || contextToken.kind === 100 /* SyntaxKind.ImportKeyword */ || contextToken.kind === 27 /* SyntaxKind.CommaToken */)) { - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; } if (canCompleteFromNamedBindings(parent)) { // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` if (contextToken.kind === 19 /* SyntaxKind.CloseBraceToken */ || contextToken.kind === 79 /* SyntaxKind.Identifier */) { isKeywordOnlyCompletion = true; - keywordCompletion = 156 /* SyntaxKind.FromKeyword */; + keywordCompletion = 158 /* SyntaxKind.FromKeyword */; } else { return parent.parent.parent; @@ -424817,25 +426027,82 @@ var ts; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return contextToken; } if (ts.isImportKeyword(contextToken) && ts.isImportDeclaration(parent)) { // `import s| from` - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleSpecifier) ? parent : undefined; } return undefined; } } + function getSingleLineReplacementSpanForImportCompletionNode(node) { + var _a, _b, _c; + if (!node) + return undefined; + var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node; + var sourceFile = top.getSourceFile(); + if (ts.rangeIsOnSingleLine(top, sourceFile)) { + return ts.createTextSpanFromNode(top, sourceFile); + } + // ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration + ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */); + // Guess which point in the import might actually be a later statement parsed as part of the import + // during parser recovery - either in the middle of named imports, or the module specifier. + var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */ + ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier + : top.moduleReference; + var withoutModuleSpecifier = { + pos: top.getFirstToken().getStart(), + end: potentialSplitPoint.pos, + }; + // The module specifier/reference was previously found to be missing, empty, or + // not a string literal - in this last case, it's likely that statement on a following + // line was parsed as the module specifier of a partially-typed import, e.g. + // import Foo| + // interface Blah {} + // This appears to be a multiline-import, and editors can't replace multiple lines. + // But if everything but the "module specifier" is on one line, by this point we can + // assume that the "module specifier" is actually just another statement, and return + // the single-line range of the import excluding that probable statement. + if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) { + return ts.createTextSpanFromRange(withoutModuleSpecifier); + } + } + // Tries to identify the first named import that is not really a named import, but rather + // just parser recovery for a situation like: + // import { Foo| + // interface Bar {} + // in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller + // will also check if this token is on a separate line from the rest of the import. + function getPotentiallyInvalidImportSpecifier(namedBindings) { + var _a; + return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) { + var _a; + return !e.propertyName && + ts.isStringANonContextualKeyword(e.name.text) && + ((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */; + }); + } function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) { return ts.isImportSpecifier(importSpecifier) && (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken)); } function canCompleteFromNamedBindings(namedBindings) { - return isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) - && (ts.isNamespaceImport(namedBindings) || namedBindings.elements.length < 2) - && !namedBindings.parent.name; + if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) { + return false; + } + if (ts.isNamedImports(namedBindings)) { + // We can only complete on named imports if there are no other named imports already, + // but parser recovery sometimes puts later statements in the named imports list, so + // we try to only consider the probably-valid ones. + var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings); + var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length; + return validImports < 2; + } + return true; } function isModuleSpecifierMissingOrEmpty(specifier) { var _a; @@ -424854,7 +426121,6 @@ var ts; function isArrowFunctionBody(node) { return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node; } - ; /** True if symbol is a type or a module containing at least one type. */ function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) { if (seenModules === void 0) { seenModules = new ts.Map(); } @@ -425003,14 +426269,14 @@ var ts; case 115 /* SyntaxKind.WhileKeyword */: case 90 /* SyntaxKind.DoKeyword */: return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences); - case 134 /* SyntaxKind.ConstructorKeyword */: - return getFromAllDeclarations(ts.isConstructorDeclaration, [134 /* SyntaxKind.ConstructorKeyword */]); - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - return getFromAllDeclarations(ts.isAccessor, [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */]); - case 132 /* SyntaxKind.AwaitKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + return getFromAllDeclarations(ts.isConstructorDeclaration, [135 /* SyntaxKind.ConstructorKeyword */]); + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + return getFromAllDeclarations(ts.isAccessor, [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */]); + case 133 /* SyntaxKind.AwaitKeyword */: return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return highlightSpans(getAsyncAndAwaitOccurrences(node)); case 125 /* SyntaxKind.YieldKeyword */: return highlightSpans(getYieldOccurrences(node)); @@ -425057,7 +426323,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -425089,16 +426355,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 249 /* SyntaxKind.SwitchStatement */: - if (statement.kind === 245 /* SyntaxKind.ContinueStatement */) { + case 252 /* SyntaxKind.SwitchStatement */: + if (statement.kind === 248 /* SyntaxKind.ContinueStatement */) { return false; } // falls through - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -425114,26 +426380,26 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { + if (modifierFlag & 256 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { return __spreadArray(__spreadArray([], declaration.members, true), [declaration], false); } else { return container.statements; } - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return __spreadArray(__spreadArray([], container.parameters, true), (ts.isClassLike(container.parent) ? container.parent.members : []), true); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: var nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. @@ -425143,12 +426409,12 @@ var ts; return __spreadArray(__spreadArray([], nodes, true), constructor.parameters, true); } } - else if (modifierFlag & 128 /* ModifierFlags.Abstract */) { + else if (modifierFlag & 256 /* ModifierFlags.Abstract */) { return __spreadArray(__spreadArray([], nodes, true), [container], false); } return nodes; // Syntactically invalid positions that the parser might produce anyway - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return undefined; default: ts.Debug.assertNever(container, "Invalid container kind."); @@ -425169,7 +426435,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 97 /* SyntaxKind.ForKeyword */, 115 /* SyntaxKind.WhileKeyword */, 90 /* SyntaxKind.DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 240 /* SyntaxKind.DoStatement */) { + if (loopNode.kind === 243 /* SyntaxKind.DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 115 /* SyntaxKind.WhileKeyword */)) { @@ -425189,13 +426455,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -425268,13 +426534,13 @@ var ts; var keywords = []; if (func.modifiers) { func.modifiers.forEach(function (modifier) { - pushKeywordIf(keywords, modifier, 131 /* SyntaxKind.AsyncKeyword */); + pushKeywordIf(keywords, modifier, 132 /* SyntaxKind.AsyncKeyword */); }); } ts.forEachChild(func, function (child) { traverseWithoutCrossingFunction(child, function (node) { if (ts.isAwaitExpression(node)) { - pushKeywordIf(keywords, node.getFirstToken(), 132 /* SyntaxKind.AwaitKeyword */); + pushKeywordIf(keywords, node.getFirstToken(), 133 /* SyntaxKind.AwaitKeyword */); } }); }); @@ -425658,14 +426924,14 @@ var ts; if (cancellationToken) cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(direct)) { handleImportCall(direct); break; } if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { var name = parent.name; if (name.kind === 79 /* SyntaxKind.Identifier */) { directImports.push(name); @@ -425676,25 +426942,25 @@ var ts; break; case 79 /* SyntaxKind.Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* ModifierFlags.Export */), /*alreadyAddedDirect*/ false); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: directImports.push(direct); var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings && namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true); } else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) { addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); } - else if (direct.exportClause.kind === 274 /* SyntaxKind.NamespaceExport */) { + else if (direct.exportClause.kind === 277 /* SyntaxKind.NamespaceExport */) { // `export * as foo from "foo"` add to indirect uses addIndirectUser(getSourceFileLikeForImportDeclaration(direct), /** addTransitiveDependencies */ true); } @@ -425703,9 +426969,9 @@ var ts; directImports.push(direct); } break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') - if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { + if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); } directImports.push(direct); @@ -425736,7 +427002,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 261 /* SyntaxKind.ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 264 /* SyntaxKind.ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUser(sourceFileLike, /** addTransitiveDependencies */ true); } @@ -425792,7 +427058,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (decl.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -425802,7 +427068,7 @@ var ts; handleNamespaceImportLike(decl); return; } - if (decl.kind === 200 /* SyntaxKind.ImportType */) { + if (decl.kind === 202 /* SyntaxKind.ImportType */) { if (decl.qualifier) { var firstIdentifier = ts.getFirstIdentifier(decl.qualifier); if (firstIdentifier.escapedText === ts.symbolName(exportSymbol)) { @@ -425818,7 +427084,7 @@ var ts; if (decl.moduleSpecifier.kind !== 10 /* SyntaxKind.StringLiteral */) { return; } - if (decl.kind === 272 /* SyntaxKind.ExportDeclaration */) { + if (decl.kind === 275 /* SyntaxKind.ExportDeclaration */) { if (decl.exportClause && ts.isNamedExports(decl.exportClause)) { searchForNamedImport(decl.exportClause); } @@ -425827,10 +427093,10 @@ var ts; var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: handleNamespaceImportLike(namedBindings.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: // 'default' might be accessed as a named import `{ default as foo }`. if (exportKind === 0 /* ExportKind.Named */ || exportKind === 1 /* ExportKind.Default */) { searchForNamedImport(namedBindings); @@ -425880,7 +427146,7 @@ var ts; } } else { - var localSymbol = element.kind === 275 /* SyntaxKind.ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 278 /* SyntaxKind.ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol. : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); @@ -425909,7 +427175,7 @@ var ts; for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { var referencingFile = sourceFiles_1[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 305 /* SyntaxKind.SourceFile */) { + if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 308 /* SyntaxKind.SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -425957,7 +427223,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -425972,15 +427238,15 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: { var decl = statement; if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { var decl = statement; if (isExternalModuleImportEquals(decl)) { action(decl, decl.moduleReference.expression); @@ -426005,7 +427271,7 @@ var ts; var parent = node.parent; var grandparent = parent.parent; if (symbol.exportSymbol) { - if (parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { // When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use. // So check that we are at the declaration. return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === parent; })) && ts.isBinaryExpression(grandparent) @@ -426089,6 +427355,8 @@ var ts; // Similarly, skip past the symbol for 'export =' if (importedSymbol.escapedName === "export=") { importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker); + if (importedSymbol === undefined) + return undefined; } // If the import has a different name than the export, do not continue searching. // If `importedName` is undefined, do continue searching as the export is anonymous. @@ -426104,25 +427372,25 @@ var ts; } // Not meant for use with export specifiers or export assignment. function getExportKindForDeclaration(node) { - return ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; + return ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; } } FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; function getExportEqualsLocalSymbol(importedSymbol, checker) { if (importedSymbol.flags & 2097152 /* SymbolFlags.Alias */) { - return ts.Debug.checkDefined(checker.getImmediateAliasedSymbol(importedSymbol)); + return checker.getImmediateAliasedSymbol(importedSymbol); } var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration); if (ts.isExportAssignment(decl)) { // `export = class {}` - return ts.Debug.checkDefined(decl.expression.symbol); + return decl.expression.symbol; } else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}` - return ts.Debug.checkDefined(decl.right.symbol); + return decl.right.symbol; } else if (ts.isSourceFile(decl)) { // json module - return ts.Debug.checkDefined(decl.symbol); + return decl.symbol; } - return ts.Debug.fail(); + return undefined; } // If a reference is a class expression, the exported node would be its parent. // If a reference is a variable declaration, the exported node would be the variable statement. @@ -426139,16 +427407,16 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return !parent.propertyName; - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: ts.Debug.assert(parent.name === node); return true; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent); default: return false; @@ -426189,21 +427457,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 262 /* SyntaxKind.ModuleBlock */); + ts.Debug.assert(parent.kind === 265 /* SyntaxKind.ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; } function isExternalModuleImportEquals(eq) { - return eq.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; + return eq.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -426297,7 +427565,7 @@ var ts; ((ts.isImportOrExportSpecifier(node.parent) || ts.isBindingElement(node.parent)) && node.parent.propertyName === node) || // Is default export - (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 513 /* ModifierFlags.ExportDefault */))) { + (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 1025 /* ModifierFlags.ExportDefault */))) { return getContextNode(node.parent); } return undefined; @@ -426306,7 +427574,7 @@ var ts; if (!node) return undefined; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !ts.isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : ts.isVariableStatement(node.parent.parent) ? @@ -426314,28 +427582,28 @@ var ts; ts.isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextNode(node.parent.parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 267 /* SyntaxKind.ImportClause */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ts.isExpressionStatement(node.parent) ? node.parent : node; - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return { start: node.initializer, end: node.expression }; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode(ts.findAncestor(node.parent, function (node) { return ts.isBinaryExpression(node) || ts.isForInOrOfStatement(node); @@ -426396,15 +427664,15 @@ var ts; return node.kind === 88 /* SyntaxKind.DefaultKeyword */ || !!ts.getDeclarationFromName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - || (node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); + || (node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); } function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) { var node = ts.getTouchingPropertyName(sourceFile, position); var referenceEntries; var entries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position); - if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || node.parent.kind === 203 /* SyntaxKind.BindingElement */ - || node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ + if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || node.parent.kind === 205 /* SyntaxKind.BindingElement */ + || node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ || node.kind === 106 /* SyntaxKind.SuperKeyword */) { referenceEntries = entries && __spreadArray([], entries, true); } @@ -426428,13 +427696,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var result_2 = []; Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_2.push(nodeEntry(node)); }); return result_2; @@ -426610,13 +427878,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return { kind: "interface" /* ScriptElementKind.interfaceElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] }; } - else if (node.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (node.kind === 228 /* SyntaxKind.ClassExpression */) { return { kind: "local class" /* ScriptElementKind.localClassElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] @@ -426670,7 +427938,7 @@ var ts; var source = ts.getDeclarationFromName(node) || (node.kind === 88 /* SyntaxKind.DefaultKeyword */ ? node.parent : ts.isLiteralComputedPropertyDeclarationName(node) ? node.parent.parent - : node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent + : node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent : undefined); var commonjsSource = source && ts.isBinaryExpression(source) ? source.left : undefined; return !!(source && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === source || d === commonjsSource; }))); @@ -426685,47 +427953,47 @@ var ts; if (!!(decl.flags & 16777216 /* NodeFlags.Ambient */)) return true; switch (decl.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: case 88 /* SyntaxKind.DefaultKeyword */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: // default import - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 285 /* SyntaxKind.JsxAttribute */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: - case 164 /* SyntaxKind.Parameter */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: // default import + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 288 /* SyntaxKind.JsxAttribute */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: + case 166 /* SyntaxKind.Parameter */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.) return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return !!decl.body; - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return !!decl.initializer || ts.isCatchClause(decl.parent); - case 168 /* SyntaxKind.MethodSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 170 /* SyntaxKind.MethodSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return false; default: return ts.Debug.failBadSyntaxKind(decl); @@ -426951,10 +428219,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (sourceFilesSet.has(decl.getSourceFile().fileName)) { references.push(nodeEntry(decl.name)); } @@ -426983,9 +428251,9 @@ var ts; } /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */ function isReadonlyTypeOperator(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(node.parent) - && node.parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + && node.parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } /** getReferencedSymbols for special node kinds. */ function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { @@ -426996,12 +428264,12 @@ var ts; } // A modifier readonly (like on a property declaration) is not special; // a readonly type keyword (like `readonly string[]`) is. - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { return undefined; } // Likewise, when we *are* looking for a special keyword, make sure we // *don’t* include readonly member modifiers. - return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); } if (ts.isImportMeta(node.parent) && node.parent.name === node) { return getAllReferencesForImportMeta(sourceFiles, cancellationToken); @@ -427068,8 +428336,8 @@ var ts; } function getSpecialSearchKind(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 173 /* SyntaxKind.Constructor */: + case 135 /* SyntaxKind.ConstructorKeyword */: return 1 /* SpecialSearchKind.Constructor */; case 79 /* SyntaxKind.Identifier */: if (ts.isClassLike(node.parent)) { @@ -427317,7 +428585,7 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 213 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 226 /* SyntaxKind.ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 215 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 228 /* SyntaxKind.ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -427327,7 +428595,7 @@ var ts; if (flags & (4 /* SymbolFlags.Property */ | 8192 /* SymbolFlags.Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasEffectiveModifier(d, 8 /* ModifierFlags.Private */) || ts.isPrivateIdentifierClassElementDeclaration(d); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 257 /* SyntaxKind.ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 260 /* SyntaxKind.ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -427356,7 +428624,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -427614,7 +428882,7 @@ var ts; } // Use the parent symbol if the location is commonjs require syntax on javascript files only. if (ts.isInJSFile(referenceLocation) - && referenceLocation.parent.kind === 203 /* SyntaxKind.BindingElement */ + && referenceLocation.parent.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) { referenceSymbol = referenceLocation.parent.symbol; // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In @@ -427721,7 +428989,7 @@ var ts; } } function addReference(referenceLocation, relatedSymbol, state) { - var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line no-in-operator + var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line local/no-in-operator // if rename symbol from default export anonymous function, for example `export default function() {}`, we do not need to add reference if (state.options.use === 2 /* FindReferencesUse.Rename */ && referenceLocation.kind === 88 /* SyntaxKind.DefaultKeyword */) { return; @@ -427787,15 +429055,15 @@ var ts; if (constructorSymbol && constructorSymbol.declarations) { for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - var ctrKeyword = ts.findChildOfKind(decl, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */ && !!ctrKeyword); + var ctrKeyword = ts.findChildOfKind(decl, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */ && !!ctrKeyword); addNode(ctrKeyword); } } if (classSymbol.exports) { classSymbol.exports.forEach(function (member) { var decl = member.valueDeclaration; - if (decl && decl.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (decl && decl.kind === 171 /* SyntaxKind.MethodDeclaration */) { var body = decl.body; if (body) { forEachDescendantOfKind(body, 108 /* SyntaxKind.ThisKeyword */, function (thisKeyword) { @@ -427819,7 +429087,7 @@ var ts; } for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */); var body = decl.body; if (body) { forEachDescendantOfKind(body, 106 /* SyntaxKind.SuperKeyword */, function (node) { @@ -427849,7 +429117,7 @@ var ts; if (refNode.kind !== 79 /* SyntaxKind.Identifier */) { return; } - if (refNode.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -427869,7 +429137,7 @@ var ts; } else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) { var body = typeHavingNode.body; - if (body.kind === 235 /* SyntaxKind.Block */) { + if (body.kind === 238 /* SyntaxKind.Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression) addIfImplementation(returnStatement.expression); @@ -427897,13 +429165,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; default: return false; @@ -427956,13 +429224,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -427983,43 +429251,43 @@ var ts; return [{ definition: { type: 0 /* DefinitionKind.Symbol */, symbol: searchSpaceNode.symbol }, references: references }]; } function isParameterName(node) { - return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 164 /* SyntaxKind.Parameter */ && node.parent.name === node; + return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 166 /* SyntaxKind.Parameter */ && node.parent.name === node; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning object literals break; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return undefined; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. default: return undefined; } - var references = ts.flatMap(searchSpaceNode.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { + var references = ts.flatMap(searchSpaceNode.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { cancellationToken.throwIfCancellationRequested(); return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) { if (!ts.isThis(node)) { @@ -428027,20 +429295,20 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return searchSpaceNode.symbol === container.symbol; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // Make sure the container belongs to the same class/object literals // and has the appropriate static modifier from the original container. return container.parent && searchSpaceNode.symbol === container.parent.symbol && ts.isStatic(container) === !!staticFlag; - case 305 /* SyntaxKind.SourceFile */: - return container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); + case 308 /* SyntaxKind.SourceFile */: + return container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); } }); }).map(function (n) { return nodeEntry(n); }); @@ -428151,7 +429419,7 @@ var ts; ts.Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & 1 /* SymbolFlags.FunctionScopedVariable */) && !!(paramProps[1].flags & 4 /* SymbolFlags.Property */)); // is [parameter, property] return fromRoot(symbol.flags & 1 /* SymbolFlags.FunctionScopedVariable */ ? paramProps[1] : paramProps[0]); } - var exportSpecifier = ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */); + var exportSpecifier = ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */); if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) { var localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); if (localSymbol) { @@ -428196,7 +429464,7 @@ var ts; }); } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { - var bindingElement = ts.getDeclarationOfKind(symbol, 203 /* SyntaxKind.BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 205 /* SyntaxKind.BindingElement */); if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) { return ts.getPropertySymbolFromBindingElement(checker, bindingElement); } @@ -428459,16 +429727,16 @@ var ts; return; } switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return (_a = ts.getAssignedName(node.parent)) === null || _a === void 0 ? void 0 : _a.getText(); } return (_b = ts.getNameOfDeclaration(node.parent)) === null || _b === void 0 ? void 0 : _b.getText(); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isModuleBlock(node.parent) && ts.isIdentifier(node.parent.parent.name)) { return node.parent.parent.name.getText(); } @@ -428683,61 +429951,65 @@ var ts; } switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // do not descend into nodes that cannot contain callable nodes return; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: recordCallSite(node); return; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // do not descend into the type side of an assertion collect(node.expression); return; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: // do not descend into the type of a variable or parameter declaration collect(node.name); collect(node.initializer); return; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: // do not descend into the type arguments of a call expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: // do not descend into the type arguments of a new expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // do not descend into the type arguments of a tagged template expression recordCallSite(node); collect(node.tag); collect(node.template); return; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // do not descend into the type arguments of a JsxOpeningLikeElement recordCallSite(node); collect(node.tagName); collect(node.attributes); return; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: recordCallSite(node); collect(node.expression); return; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: recordCallSite(node); ts.forEachChild(node, collect); break; + case 235 /* SyntaxKind.SatisfiesExpression */: + // do not descend into the type side of an assertion + collect(node.expression); + return; } if (ts.isPartOfTypeNode(node)) { // do not descend into types @@ -428792,25 +430064,25 @@ var ts; var callSites = []; var collect = createCallSiteCollector(program, callSites); switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: collectCallSitesOfSourceFile(node, collect); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: collectCallSitesOfModuleDeclaration(node, collect); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: collectCallSitesOfFunctionLikeDeclaration(program.getTypeChecker(), node, collect); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: collectCallSitesOfClassLikeDeclaration(node, collect); break; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: collectCallSitesOfClassStaticBlockDeclaration(node, collect); break; default: @@ -429081,7 +430353,7 @@ var ts; } var parent = node.parent; var typeChecker = program.getTypeChecker(); - if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { + if (node.kind === 161 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { return getDefinitionFromOverriddenMember(typeChecker, node) || ts.emptyArray; } // Labels @@ -429089,6 +430361,12 @@ var ts; var label = ts.getTargetLabel(node.parent, node.text); return label ? [createDefinitionInfoFromName(typeChecker, label, "label" /* ScriptElementKind.label */, node.text, /*containerName*/ undefined)] : undefined; // TODO: GH#18217 } + if (node.kind === 105 /* SyntaxKind.ReturnKeyword */) { + var functionDeclaration = ts.findAncestor(node.parent, function (n) { + return ts.isClassStaticBlockDeclaration(n) ? "quit" : ts.isFunctionLikeDeclaration(n); + }); + return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : undefined; + } if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) { var classDecl = node.parent.parent; var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution; @@ -429157,7 +430435,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node, /*unverified*/ false, failedAliasResolution); }) : ts.emptyArray; return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray); @@ -429224,13 +430502,16 @@ var ts; if (!baseDeclaration) return; var baseTypeNode = ts.getEffectiveBaseTypeNode(baseDeclaration); - var baseType = baseTypeNode ? typeChecker.getTypeAtLocation(baseTypeNode) : undefined; - if (!baseType) + if (!baseTypeNode) + return; + var expression = ts.skipParentheses(baseTypeNode.expression); + var base = ts.isClassExpression(expression) ? expression.symbol : typeChecker.getSymbolAtLocation(expression); + if (!base) return; var name = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(classElement.name)); var symbol = ts.hasStaticModifier(classElement) - ? typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbolAtLocation(baseType.symbol, baseDeclaration), name) - : typeChecker.getPropertyOfType(baseType, name); + ? typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbol(base), name) + : typeChecker.getPropertyOfType(typeChecker.getDeclaredTypeOfSymbol(base), name); if (!symbol) return; return getDefinitionFromSymbol(typeChecker, symbol, node); @@ -429363,7 +430644,7 @@ var ts; if (node.parent === declaration) { return true; } - if (declaration.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (declaration.kind === 271 /* SyntaxKind.NamespaceImport */) { return false; } return true; @@ -429405,7 +430686,7 @@ var ts; function getConstructSignatureDefinition() { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 134 /* SyntaxKind.ConstructorKeyword */)) { + if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 135 /* SyntaxKind.ConstructorKeyword */)) { var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration"); return getSignatureDefinition(cls.members, /*selectConstructors*/ true); } @@ -429457,22 +430738,22 @@ var ts; return isDefinitionVisible(checker, declaration.parent); // Handle some exceptions here like arrow function, members of class and object literal expression which are technically not visible but we want the definition to be determined by its parent switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // Private/protected properties/methods are not visible if (ts.hasEffectiveModifier(declaration, 8 /* ModifierFlags.Private */)) return false; // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: return isDefinitionVisible(checker, declaration.parent); default: return false; @@ -429510,9 +430791,9 @@ var ts; } function isConstructorLike(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return true; default: return false; @@ -429618,17 +430899,17 @@ var ts; ts.forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) { var jsdoc = _a[_i]; - var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 327 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); + var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 330 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @typedefs are themselves declarations with associated comments // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation if (jsdoc.comment === undefined && !inheritDoc || ts.isJSDoc(jsdoc) - && declaration.kind !== 345 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 338 /* SyntaxKind.JSDocCallbackTag */ + && declaration.kind !== 348 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 341 /* SyntaxKind.JSDocCallbackTag */ && jsdoc.tags - && jsdoc.tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !jsdoc.tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + && jsdoc.tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !jsdoc.tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { continue; } var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : []; @@ -429648,11 +430929,11 @@ var ts; } function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return [declaration]; - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return [declaration, declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -429666,8 +430947,8 @@ var ts; // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation - if (tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + if (tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { return; } for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) { @@ -429682,17 +430963,17 @@ var ts; if (typeof comment === "string") { return [ts.textPart(comment)]; } - return ts.flatMap(comment, function (node) { return node.kind === 321 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); + return ts.flatMap(comment, function (node) { return node.kind === 324 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); } function getCommentDisplayParts(tag, checker) { var comment = tag.comment, kind = tag.kind; var namePart = getTagNameDisplayPart(kind); switch (kind) { - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return withNode(tag.class); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return withNode(tag.class); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: var templateTag = tag; var displayParts_3 = []; if (templateTag.constraint) { @@ -429714,13 +430995,13 @@ var ts; displayParts_3.push.apply(displayParts_3, __spreadArray([ts.spacePart()], getDisplayPartsFromComment(comment, checker), true)); } return displayParts_3; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return withNode(tag.typeExpression); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: - case 346 /* SyntaxKind.JSDocSeeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: var name = tag.name; return name ? withNode(name) : comment === undefined ? undefined @@ -429747,14 +431028,14 @@ var ts; } function getTagNameDisplayPart(kind) { switch (kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return ts.parameterNamePart; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return ts.propertyNamePart; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return ts.typeParameterNamePart; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return ts.typeAliasNamePart; default: return ts.textPart; @@ -429925,43 +431206,48 @@ var ts; } function getCommentOwnerInfoWorker(commentOwner, options) { switch (commentOwner.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: var host = commentOwner; return { commentOwner: commentOwner, parameters: host.parameters, hasReturn: hasReturn(host, options) }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getCommentOwnerInfoWorker(commentOwner.initializer, options); - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 237 /* SyntaxKind.VariableStatement */: { + case 168 /* SyntaxKind.PropertySignature */: { + var host_1 = commentOwner; + return host_1.type && ts.isFunctionTypeNode(host_1.type) + ? { commentOwner: commentOwner, parameters: host_1.type.parameters, hasReturn: hasReturn(host_1.type, options) } + : { commentOwner: commentOwner }; + } + case 240 /* SyntaxKind.VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; - var host_1 = varDeclarations.length === 1 && varDeclarations[0].initializer + var host_2 = varDeclarations.length === 1 && varDeclarations[0].initializer ? getRightHandSideOfAssignment(varDeclarations[0].initializer) : undefined; - return host_1 - ? { commentOwner: commentOwner, parameters: host_1.parameters, hasReturn: hasReturn(host_1, options) } + return host_2 + ? { commentOwner: commentOwner, parameters: host_2.parameters, hasReturn: hasReturn(host_2, options) } : { commentOwner: commentOwner }; } - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return "quit"; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - return commentOwner.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 238 /* SyntaxKind.ExpressionStatement */: + return commentOwner.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 241 /* SyntaxKind.ExpressionStatement */: return getCommentOwnerInfoWorker(commentOwner.expression, options); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var be = commentOwner; if (ts.getAssignmentDeclarationKind(be) === 0 /* AssignmentDeclarationKind.None */) { return "quit"; @@ -429970,7 +431256,7 @@ var ts; ? { commentOwner: commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner: commentOwner }; } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: var init = commentOwner.initializer; if (init && (ts.isFunctionExpression(init) || ts.isArrowFunction(init))) { return { commentOwner: commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) }; @@ -429979,18 +431265,18 @@ var ts; } function hasReturn(node, options) { return !!(options === null || options === void 0 ? void 0 : options.generateReturnInDocTemplate) && - (ts.isArrowFunction(node) && ts.isExpression(node.body) + (ts.isFunctionTypeNode(node) || ts.isArrowFunction(node) && ts.isExpression(node.body) || ts.isFunctionLikeDeclaration(node) && node.body && ts.isBlock(node.body) && !!ts.forEachReturnStatement(node.body, function (n) { return n; })); } function getRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (rightHandSide.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return rightHandSide; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return ts.find(rightHandSide.members, ts.isConstructorDeclaration); } } @@ -430049,9 +431335,9 @@ var ts; } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217 var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -430061,7 +431347,7 @@ var ts; } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); - return !!name && (pushLiteral(name, containers) || name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); + return !!name && (pushLiteral(name, containers) || name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); } // Only added the names of computed properties if they're simple dotted expressions, like: // @@ -430078,7 +431364,7 @@ var ts; // First, if we started with a computed property name, then add all but the last // portion into the container array. var name = ts.getNameOfDeclaration(declaration); - if (name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { + if (name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { return ts.emptyArray; } // Don't include the last portion. @@ -430295,7 +431581,7 @@ var ts; */ function hasNavigationBarName(node) { return !ts.hasDynamicName(node) || - (node.kind !== 221 /* SyntaxKind.BinaryExpression */ && + (node.kind !== 223 /* SyntaxKind.BinaryExpression */ && ts.isPropertyAccessExpression(node.name.expression) && ts.isIdentifier(node.name.expression.expression) && ts.idText(node.name.expression.expression) === "Symbol"); @@ -430308,7 +431594,7 @@ var ts; return; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -430320,25 +431606,25 @@ var ts; } } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 170 /* SyntaxKind.MethodSignature */: if (hasNavigationBarName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (hasNavigationBarName(node)) { addNodeWithRecursiveInitializer(node); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (hasNavigationBarName(node)) { addLeafNode(node); } break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -430350,7 +431636,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -430361,17 +431647,17 @@ var ts; } } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: addNodeWithRecursiveChild(node, node.name); break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: var expression = node.expression; // Use the expression as the name of the SpreadAssignment, otherwise show as . ts.isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: { + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: { var child = node; if (ts.isBindingPattern(child.name)) { addChildrenRecursively(child.name); @@ -430381,7 +431667,7 @@ var ts; } break; } - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: var nameNode = node.name; // If we see a function declaration track as a possible ES5 class if (nameNode && ts.isIdentifier(nameNode)) { @@ -430389,11 +431675,11 @@ var ts; } addNodeWithRecursiveChild(node, node.body); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -430403,9 +431689,9 @@ var ts; } endNode(); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -430413,10 +431699,10 @@ var ts; } endNode(); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression_1 = node.expression; var child = ts.isObjectLiteralExpression(expression_1) || ts.isCallExpression(expression_1) ? expression_1 : ts.isArrowFunction(expression_1) || ts.isFunctionExpression(expression_1) ? expression_1.body : undefined; @@ -430430,16 +431716,16 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 176 /* SyntaxKind.IndexSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: addLeafNode(node); break; - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var special = ts.getAssignmentDeclarationKind(node); switch (special) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -430679,12 +431965,12 @@ var ts; return false; } switch (a.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.isStatic(a) === ts.isStatic(b); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return areSameModule(a, b) && getFullyQualifiedModuleName(a) === getFullyQualifiedModuleName(b); default: @@ -430706,7 +431992,7 @@ var ts; if (!a.body || !b.body) { return a.body === b.body; } - return a.body.kind === b.body.kind && (a.body.kind !== 261 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 264 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -430736,7 +432022,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -430745,16 +432031,16 @@ var ts; return propertyName && ts.unescapeLeadingUnderscores(propertyName); } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: return getFunctionOrClassName(node); default: return undefined; } } function getItemName(node, name) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return cleanText(getModuleName(node)); } if (name) { @@ -430766,32 +432052,32 @@ var ts; } } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"".concat(ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))), "\"") : ""; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return ts.isExportAssignment(node) && node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } // We may get a string with newlines or other whitespace in the case of an object dereference // (eg: "app\n.onactivated"), so we should remove the whitespace for readability in the // navigation bar. return getFunctionOrClassName(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return "new()"; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return "()"; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "[]"; default: return ""; @@ -430824,19 +432110,19 @@ var ts; } // Some nodes are otherwise important enough to always include in the primary navigation menu. switch (navigationBarNodeKind(item)) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 305 /* SyntaxKind.SourceFile */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return true; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -430846,10 +432132,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: return true; default: return false; @@ -430911,7 +432197,7 @@ var ts; function getFullyQualifiedModuleName(moduleDeclaration) { // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = [ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; - while (moduleDeclaration.body && moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -430925,13 +432211,13 @@ var ts; return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return !member.name || member.name.kind === 164 /* SyntaxKind.ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.parent && node.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -430954,7 +432240,7 @@ var ts; return nodeText(parent.name); } // Default exports are named "default" - else if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + else if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } else if (ts.isClassLike(node)) { @@ -430989,9 +432275,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; default: return false; @@ -431020,23 +432306,39 @@ var ts; * 2) Coalescing imports from the same module * 3) Sorting imports */ - function organizeImports(sourceFile, formatContext, host, program, preferences, skipDestructiveCodeActions) { + function organizeImports(sourceFile, formatContext, host, program, preferences, mode) { var changeTracker = ts.textChanges.ChangeTracker.fromContext({ host: host, formatContext: formatContext, preferences: preferences }); - var coalesceAndOrganizeImports = function (importGroup) { return ts.stableSort(coalesceImports(removeUnusedImports(importGroup, sourceFile, program, skipDestructiveCodeActions)), function (s1, s2) { return compareImportsOrRequireStatements(s1, s2); }); }; + var shouldSort = mode === "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ || mode === "All" /* OrganizeImportsMode.All */; + var shouldCombine = shouldSort; // These are currently inseparable, but I draw a distinction for clarity and in case we add modes in the future. + var shouldRemove = mode === "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */ || mode === "All" /* OrganizeImportsMode.All */; + var maybeRemove = shouldRemove ? removeUnusedImports : ts.identity; + var maybeCoalesce = shouldCombine ? coalesceImports : ts.identity; + var processImportsOfSameModuleSpecifier = function (importGroup) { + var processedDeclarations = maybeCoalesce(maybeRemove(importGroup, sourceFile, program)); + return shouldSort + ? ts.stableSort(processedDeclarations, function (s1, s2) { return compareImportsOrRequireStatements(s1, s2); }) + : processedDeclarations; + }; // All of the old ImportDeclarations in the file, in syntactic order. var topLevelImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, sourceFile.statements.filter(ts.isImportDeclaration)); - topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, coalesceAndOrganizeImports); }); - // All of the old ExportDeclarations in the file, in syntactic order. - var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration); - organizeImportsWorker(topLevelExportDecls, coalesceExports); + topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); }); + // Exports are always used + if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) { + // All of the old ExportDeclarations in the file, in syntactic order. + var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration); + organizeImportsWorker(topLevelExportDecls, coalesceExports); + } for (var _i = 0, _a = sourceFile.statements.filter(ts.isAmbientModule); _i < _a.length; _i++) { var ambientModule = _a[_i]; if (!ambientModule.body) continue; var ambientModuleImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(ts.isImportDeclaration)); - ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, coalesceAndOrganizeImports); }); - var ambientModuleExportDecls = ambientModule.body.statements.filter(ts.isExportDeclaration); - organizeImportsWorker(ambientModuleExportDecls, coalesceExports); + ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); }); + // Exports are always used + if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) { + var ambientModuleExportDecls = ambientModule.body.statements.filter(ts.isExportDeclaration); + organizeImportsWorker(ambientModuleExportDecls, coalesceExports); + } } return changeTracker.getChanges(); function organizeImportsWorker(oldImportDecls, coalesce) { @@ -431049,8 +432351,12 @@ var ts; // Consider: we could do a more careful check that this trivia is actually a header, // but the consequences of being wrong are very minor. ts.suppressLeadingTrivia(oldImportDecls[0]); - var oldImportGroups = ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier); }); - var sortedImportGroups = ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); }); + var oldImportGroups = shouldCombine + ? ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier); }) + : [oldImportDecls]; + var sortedImportGroups = shouldSort + ? ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); }) + : oldImportGroups; var newImportDecls = ts.flatMap(sortedImportGroups, function (importGroup) { return getExternalModuleName(importGroup[0].moduleSpecifier) ? coalesce(importGroup) @@ -431114,11 +432420,7 @@ var ts; } return false; } - function removeUnusedImports(oldImports, sourceFile, program, skipDestructiveCodeActions) { - // As a precaution, consider unused import detection to be destructive (GH #43051) - if (skipDestructiveCodeActions) { - return oldImports; - } + function removeUnusedImports(oldImports, sourceFile, program) { var typeChecker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); var jsxNamespace = typeChecker.getJsxNamespace(sourceFile); @@ -431392,11 +432694,11 @@ var ts; function getModuleSpecifierExpression(declaration) { var _a; switch (declaration.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return (_a = ts.tryCast(declaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return declaration.moduleSpecifier; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return declaration.declarationList.declarations[0].initializer.arguments[0]; } } @@ -431435,19 +432737,19 @@ var ts; function getImportKindOrder(s1) { var _a; switch (s1.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!s1.importClause) return 0; if (s1.importClause.isTypeOnly) return 1; - if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 268 /* SyntaxKind.NamespaceImport */) + if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 271 /* SyntaxKind.NamespaceImport */) return 2; if (s1.importClause.name) return 3; return 4; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return 5; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return 6; } } @@ -431636,7 +432938,7 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionLike(n.parent)) { return functionSpan(n.parent, n, sourceFile); } @@ -431644,16 +432946,16 @@ var ts; // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. switch (n.parent.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 243 /* SyntaxKind.DoStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 295 /* SyntaxKind.CatchClause */: return spanForNode(n.parent); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { @@ -431670,42 +432972,42 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* OutliningSpanKind.Code */); } - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanForNode(n.parent); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 263 /* SyntaxKind.CaseBlock */: - case 182 /* SyntaxKind.TypeLiteral */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 266 /* SyntaxKind.CaseBlock */: + case 184 /* SyntaxKind.TypeLiteral */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return spanForNode(n); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isTupleTypeNode(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return spanForNodeArray(n.statements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 22 /* SyntaxKind.OpenBracketToken */); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return spanForJSXElement(n); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return spanForJSXFragment(n); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return spanForJSXAttributes(n.attributes); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return spanForTemplateLiteral(n); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isBindingElement(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return spanForArrowFunction(n); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return spanForCallExpression(n); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanForParenthesizedExpression(n); } function spanForCallExpression(node) { @@ -431778,7 +433080,7 @@ var ts; function functionSpan(node, body, sourceFile) { var openToken = tryGetFunctionOpenToken(node, body, sourceFile); var closeToken = ts.findChildOfKind(body, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 214 /* SyntaxKind.ArrowFunction */); + return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 216 /* SyntaxKind.ArrowFunction */); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { if (autoCollapse === void 0) { autoCollapse = false; } @@ -431974,7 +433276,7 @@ var ts; return bestMatch; } function betterMatch(a, b) { - return ts.min(a, b, compareMatches); + return ts.min([a, b], compareMatches); } function compareMatches(a, b) { return a === undefined ? 1 /* Comparison.GreaterThan */ : b === undefined ? -1 /* Comparison.LessThan */ @@ -432322,10 +433624,10 @@ var ts; */ function tryConsumeDeclare() { var token = ts.scanner.getToken(); - if (token === 135 /* SyntaxKind.DeclareKeyword */) { + if (token === 136 /* SyntaxKind.DeclareKeyword */) { // declare module "mod" token = nextToken(); - if (token === 141 /* SyntaxKind.ModuleKeyword */) { + if (token === 142 /* SyntaxKind.ModuleKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { recordAmbientExternalModule(); @@ -432359,10 +433661,10 @@ var ts; return true; } else { - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); - return token !== 156 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || + return token !== 158 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || token === 18 /* SyntaxKind.OpenBraceToken */ || token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)); @@ -432373,7 +433675,7 @@ var ts; } if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import d from "mod"; @@ -432404,7 +433706,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import {a as A} from "mod"; @@ -432416,11 +433718,11 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 127 /* SyntaxKind.AsKeyword */) { + if (token === 128 /* SyntaxKind.AsKeyword */) { token = nextToken(); if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import * as NS from "mod" @@ -432441,7 +433743,7 @@ var ts; if (token === 93 /* SyntaxKind.ExportKeyword */) { markAsExternalModuleIfTopLevel(); token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 41 /* SyntaxKind.AsteriskToken */ || @@ -432460,7 +433762,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export {a as A} from "mod"; @@ -432472,7 +433774,7 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export * from "mod" @@ -432482,7 +433784,7 @@ var ts; } else if (token === 100 /* SyntaxKind.ImportKeyword */) { token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 79 /* SyntaxKind.Identifier */ || @@ -432508,7 +433810,7 @@ var ts; function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals) { if (allowTemplateLiterals === void 0) { allowTemplateLiterals = false; } var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); - if (token === 146 /* SyntaxKind.RequireKeyword */) { + if (token === 147 /* SyntaxKind.RequireKeyword */) { token = nextToken(); if (token === 20 /* SyntaxKind.OpenParenToken */) { token = nextToken(); @@ -432583,8 +433885,8 @@ var ts; } if (ts.scanner.getToken() === 15 /* SyntaxKind.TemplateHead */) { var stack = [ts.scanner.getToken()]; - var token = ts.scanner.scan(); loop: while (ts.length(stack)) { + var token = ts.scanner.scan(); switch (token) { case 1 /* SyntaxKind.EndOfFileToken */: break loop; @@ -432612,7 +433914,6 @@ var ts; } break; } - token = ts.scanner.scan(); } nextToken(); } @@ -432720,7 +434021,7 @@ var ts; return getRenameInfoError(wouldRenameNodeModules); } var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) + var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) ? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node)) : undefined; var displayName = specifierName || typeChecker.symbolToString(symbol); @@ -432865,6 +434166,10 @@ var ts; pushSelectionCommentRange(comment.pos, comment.end); } if (positionShouldSnapToNode(sourceFile, pos, node)) { + if (ts.isFunctionBody(node) + && ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) { + pushSelectionRange(node.getStart(sourceFile), node.getEnd()); + } // 1. Blocks are effectively redundant with SyntaxLists. // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping // of things that should be considered independently. @@ -433002,14 +434307,14 @@ var ts; ts.Debug.assertEqual(closeBraceToken.kind, 19 /* SyntaxKind.CloseBraceToken */); // Group `-/+readonly` and `-/+?` var groupedWithPlusMinusTokens = groupChildren(children, function (child) { - return child === node.readonlyToken || child.kind === 145 /* SyntaxKind.ReadonlyKeyword */ || + return child === node.readonlyToken || child.kind === 146 /* SyntaxKind.ReadonlyKeyword */ || child === node.questionToken || child.kind === 57 /* SyntaxKind.QuestionToken */; }); // Group type parameter with surrounding brackets var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) { var kind = _a.kind; return kind === 22 /* SyntaxKind.OpenBracketToken */ || - kind === 163 /* SyntaxKind.TypeParameter */ || + kind === 165 /* SyntaxKind.TypeParameter */ || kind === 23 /* SyntaxKind.CloseBracketToken */; }); return [ @@ -433027,7 +434332,7 @@ var ts; var children = groupChildren(node.getChildren(), function (child) { return child === node.name || ts.contains(node.modifiers, child); }); - var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDoc */ ? children[0] : undefined; + var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 323 /* SyntaxKind.JSDoc */ ? children[0] : undefined; var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children; var splittedChildren = splitChildren(withJSDocSeparated, function (_a) { var kind = _a.kind; @@ -433126,22 +434431,22 @@ var ts; return kind === 18 /* SyntaxKind.OpenBraceToken */ || kind === 22 /* SyntaxKind.OpenBracketToken */ || kind === 20 /* SyntaxKind.OpenParenToken */ - || kind === 280 /* SyntaxKind.JsxOpeningElement */; + || kind === 283 /* SyntaxKind.JsxOpeningElement */; } function isListCloser(token) { var kind = token && token.kind; return kind === 19 /* SyntaxKind.CloseBraceToken */ || kind === 23 /* SyntaxKind.CloseBracketToken */ || kind === 21 /* SyntaxKind.CloseParenToken */ - || kind === 281 /* SyntaxKind.JsxClosingElement */; + || kind === 284 /* SyntaxKind.JsxClosingElement */; } function getEndPos(sourceFile, node) { switch (node.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 342 /* SyntaxKind.JSDocThisTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 345 /* SyntaxKind.JSDocThisTag */: return sourceFile.getLineEndOfPosition(node.getStart()); default: return node.getEnd(); @@ -433351,10 +434656,10 @@ var ts; } return undefined; } - else if (ts.isTemplateHead(node) && parent.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + else if (ts.isTemplateHead(node) && parent.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var templateExpression = parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 223 /* SyntaxKind.TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 225 /* SyntaxKind.TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } @@ -433426,17 +434731,17 @@ var ts; return undefined; var parent = startingToken.parent; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: var info = getArgumentOrParameterListInfo(startingToken, position, sourceFile); if (!info) return undefined; var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent); return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan }; - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var highestBinary = getHighestBinary(parent); var contextualType_1 = checker.getContextualType(highestBinary); var argumentIndex_1 = startingToken.kind === 20 /* SyntaxKind.OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1; @@ -433507,11 +434812,11 @@ var ts; // not enough to put us in the substitution expression; we should consider ourselves part of // the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1). // - /* eslint-disable no-double-space */ + /* eslint-disable local/no-double-space */ // Example: f `# abcd $#{# 1 + 1# }# efghi ${ #"#hello"# } # ` // ^ ^ ^ ^ ^ ^ ^ ^ ^ // Case: 1 1 3 2 1 3 2 2 1 - /* eslint-enable no-double-space */ + /* eslint-enable local/no-double-space */ ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); if (ts.isTemplateLiteralToken(node)) { if (ts.isInsideTemplateLiteral(node, position, sourceFile)) { @@ -433560,7 +434865,7 @@ var ts; // | | // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { var lastSpan = ts.last(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -433765,14 +435070,14 @@ var ts; return; } switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { @@ -433916,7 +435221,7 @@ var ts; } function isHintableLiteral(node) { switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; return ts.isLiteralExpression(operand) || ts.isIdentifier(operand) && ts.isInfinityOrNaNString(operand.escapedText); } @@ -433924,7 +435229,7 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; case 79 /* SyntaxKind.Identifier */: { var name = node.escapedText; @@ -434245,11 +435550,11 @@ var ts; function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some(function (statement) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return statement.declarationList.declarations.some(function (decl) { return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; if (!ts.isBinaryExpression(expression)) return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true); @@ -434266,12 +435571,12 @@ var ts; } function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -434347,20 +435652,20 @@ var ts; // should be kept up to date with getTransformationBody in convertToAsyncFunction.ts function isFixablePromiseArgument(arg, checker) { switch (arg.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var functionFlags = ts.getFunctionFlags(arg); if (functionFlags & 1 /* FunctionFlags.Generator */) { return false; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); // falls through case 104 /* SyntaxKind.NullKeyword */: return true; case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var symbol = checker.getSymbolAtLocation(arg); if (!symbol) { return false; @@ -434377,24 +435682,24 @@ var ts; } function canBeConvertedToClass(node, checker) { var _a, _b, _c, _d; - if (node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (node.kind === 215 /* SyntaxKind.FunctionExpression */) { if (ts.isVariableDeclaration(node.parent) && ((_a = node.symbol.members) === null || _a === void 0 ? void 0 : _a.size)) { return true; } var symbol = checker.getSymbolOfExpando(node, /*allowDeclaration*/ false); return !!(symbol && (((_b = symbol.exports) === null || _b === void 0 ? void 0 : _b.size) || ((_c = symbol.members) === null || _c === void 0 ? void 0 : _c.size))); } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */) { return !!((_d = node.symbol.members) === null || _d === void 0 ? void 0 : _d.size); } return false; } function canBeConvertedToAsync(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -434416,7 +435721,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* SymbolFlags.Class */) { - return ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */) ? "local class" /* ScriptElementKind.localClassElement */ : "class" /* ScriptElementKind.classElement */; } if (flags & 384 /* SymbolFlags.Enum */) @@ -434479,6 +435784,8 @@ var ts; return "method" /* ScriptElementKind.memberFunctionElement */; if (flags & 16384 /* SymbolFlags.Constructor */) return "constructor" /* ScriptElementKind.constructorImplementationElement */; + if (flags & 131072 /* SymbolFlags.Signature */) + return "index" /* ScriptElementKind.indexSignatureElement */; if (flags & 4 /* SymbolFlags.Property */) { if (flags & 33554432 /* SymbolFlags.Transient */ && symbol.checkFlags & 6 /* CheckFlags.Synthetic */) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property @@ -434562,12 +435869,15 @@ var ts; var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; }); if (declaration) { switch (declaration.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: symbolKind = "getter" /* ScriptElementKind.memberGetAccessorElement */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: symbolKind = "setter" /* ScriptElementKind.memberSetAccessorElement */; break; + case 169 /* SyntaxKind.PropertyDeclaration */: + symbolKind = "accessor" /* ScriptElementKind.memberAccessorVariableElement */; + break; default: ts.Debug.assertNever(declaration); } @@ -434578,7 +435888,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (location.parent && location.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -434598,7 +435908,7 @@ var ts; } if (callExpressionLike) { signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217 - var useConstructSignatures = callExpressionLike.kind === 209 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); + var useConstructSignatures = callExpressionLike.kind === 211 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (signature && !ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -434662,29 +435972,29 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* SymbolFlags.Accessor */)) || // name of function declaration - (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 171 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration + (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 173 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it var functionDeclaration_1 = location.parent; // Use function declaration to write the signatures only if the symbol corresponding to this declaration var locationIsSymbolDeclaration = symbol.declarations && ts.find(symbol.declarations, function (declaration) { - return declaration === (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); + return declaration === (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); }); if (locationIsSymbolDeclaration) { - var allSignatures = functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217 } else { signature = allSignatures[0]; } - if (functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */) { + if (functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */) { // show (constructor) Type(...) signature symbolKind = "constructor" /* ScriptElementKind.constructorImplementationElement */; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 174 /* SyntaxKind.CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 176 /* SyntaxKind.CallSignature */ && !(type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ || type.symbol.flags & 4096 /* SymbolFlags.ObjectLiteral */) ? type.symbol : symbol, symbolKind); } if (signature) { @@ -434697,7 +436007,7 @@ var ts; } if (symbolFlags & 32 /* SymbolFlags.Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -434720,7 +436030,7 @@ var ts; } if ((symbolFlags & 524288 /* SymbolFlags.TypeAlias */) && (semanticMeaning & 2 /* SemanticMeaning.Type */)) { prefixNextMeaning(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -434741,9 +436051,9 @@ var ts; } if (symbolFlags & 1536 /* SymbolFlags.Module */ && !isThisExpression) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 264 /* SyntaxKind.ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 79 /* SyntaxKind.Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 142 /* SyntaxKind.NamespaceKeyword */ : 141 /* SyntaxKind.ModuleKeyword */)); + displayParts.push(ts.keywordPart(isNamespace ? 143 /* SyntaxKind.NamespaceKeyword */ : 142 /* SyntaxKind.ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -434762,7 +436072,7 @@ var ts; } else { // Method/function type parameter - var decl = ts.getDeclarationOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var decl = ts.getDeclarationOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (decl === undefined) return ts.Debug.fail(); var declaration = decl.parent; @@ -434770,21 +436080,21 @@ var ts; if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217 - if (declaration.kind === 175 /* SyntaxKind.ConstructSignature */) { + if (declaration.kind === 177 /* SyntaxKind.ConstructSignature */) { displayParts.push(ts.keywordPart(103 /* SyntaxKind.NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 174 /* SyntaxKind.CallSignature */ && declaration.name) { + else if (declaration.kind !== 176 /* SyntaxKind.CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* TypeFormatFlags.WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + else if (declaration.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -434796,7 +436106,7 @@ var ts; symbolKind = "enum member" /* ScriptElementKind.enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; - if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 299 /* SyntaxKind.EnumMember */) { + if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 302 /* SyntaxKind.EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -434832,17 +436142,17 @@ var ts; } if (symbol.declarations) { switch (symbol.declarations[0].kind) { - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(142 /* SyntaxKind.NamespaceKeyword */)); + displayParts.push(ts.keywordPart(143 /* SyntaxKind.NamespaceKeyword */)); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 63 /* SyntaxKind.EqualsToken */ : 88 /* SyntaxKind.DefaultKeyword */)); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); break; default: @@ -434852,13 +436162,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(63 /* SyntaxKind.EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(146 /* SyntaxKind.RequireKeyword */)); + displayParts.push(ts.keywordPart(147 /* SyntaxKind.RequireKeyword */)); displayParts.push(ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)); @@ -434888,16 +436198,18 @@ var ts; } // For properties, variables and local vars: show the type if (symbolKind === "property" /* ScriptElementKind.memberVariableElement */ || + symbolKind === "accessor" /* ScriptElementKind.memberAccessorVariableElement */ || symbolKind === "getter" /* ScriptElementKind.memberGetAccessorElement */ || symbolKind === "setter" /* ScriptElementKind.memberSetAccessorElement */ || symbolKind === "JSX attribute" /* ScriptElementKind.jsxAttribute */ || symbolFlags & 3 /* SymbolFlags.Variable */ || symbolKind === "local var" /* ScriptElementKind.localVariableElement */ || + symbolKind === "index" /* ScriptElementKind.indexSignatureElement */ || isThisExpression) { displayParts.push(ts.punctuationPart(58 /* SyntaxKind.ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially - if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */) { + if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */ && symbolKind !== "index" /* ScriptElementKind.indexSignatureElement */) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { var param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration, symbolDisplayNodeBuilderFlags); getPrinter().writeNode(4 /* EmitHint.Unspecified */, param, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosingDeclaration)), writer); @@ -434941,10 +436253,10 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 305 /* SyntaxKind.SourceFile */; })) { + if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 308 /* SyntaxKind.SourceFile */; })) { for (var _i = 0, _b = symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - if (!declaration.parent || declaration.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -435005,10 +436317,34 @@ var ts; displayParts.push(ts.spacePart()); } function addFullSymbolName(symbolToDisplay, enclosingDeclaration) { + var indexInfos; if (alias && symbolToDisplay === symbol) { symbolToDisplay = alias; } - var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + if (symbolKind === "index" /* ScriptElementKind.indexSignatureElement */) { + indexInfos = typeChecker.getIndexInfosOfIndexSymbol(symbolToDisplay); + } + var fullSymbolDisplayParts = []; + if (symbolToDisplay.flags & 131072 /* SymbolFlags.Signature */ && indexInfos) { + if (symbolToDisplay.parent) { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay.parent); + } + fullSymbolDisplayParts.push(ts.punctuationPart(22 /* SyntaxKind.OpenBracketToken */)); + //Needed to handle more than one type of index + indexInfos.forEach(function (info, i) { + //Needed to handle template literals + fullSymbolDisplayParts.push.apply(fullSymbolDisplayParts, ts.typeToDisplayParts(typeChecker, info.keyType)); + if (i !== indexInfos.length - 1) { + fullSymbolDisplayParts.push(ts.spacePart()); + fullSymbolDisplayParts.push(ts.punctuationPart(51 /* SyntaxKind.BarToken */)); + fullSymbolDisplayParts.push(ts.spacePart()); + } + }); + fullSymbolDisplayParts.push(ts.punctuationPart(23 /* SyntaxKind.CloseBracketToken */)); + } + else { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + } ts.addRange(displayParts, fullSymbolDisplayParts); if (symbol.flags & 16777216 /* SymbolFlags.Optional */) { displayParts.push(ts.punctuationPart(57 /* SyntaxKind.QuestionToken */)); @@ -435056,7 +436392,7 @@ var ts; tags = signature.getJsDocTags(); if (allSignatures.length > 1 && documentation.length === 0 && tags.length === 0) { documentation = allSignatures[0].getDocumentationComment(typeChecker); - tags = allSignatures[0].getJsDocTags(); + tags = allSignatures[0].getJsDocTags().filter(function (tag) { return tag.name !== "deprecated"; }); // should only include @deprecated JSDoc tag on the first overload (#49368) } } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { @@ -435074,16 +436410,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (declaration.kind === 215 /* SyntaxKind.FunctionExpression */) { return true; } - if (declaration.kind !== 254 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */) { + if (declaration.kind !== 257 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 305 /* SyntaxKind.SourceFile */ || parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ || parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return false; } } @@ -435388,10 +436724,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 285 /* SyntaxKind.JsxAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 288 /* SyntaxKind.JsxAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier. return ts.isKeyword(node.kind) || node.kind === 79 /* SyntaxKind.Identifier */; } @@ -435399,7 +436735,7 @@ var ts; return false; } function shouldRescanJsxText(node) { - return ts.isJsxText(node); + return ts.isJsxText(node) || ts.isJsxElement(node) && (lastTokenInfo === null || lastTokenInfo === void 0 ? void 0 : lastTokenInfo.token.kind) === 11 /* SyntaxKind.JsxText */; } function shouldRescanSlashToken(container) { return container.kind === 13 /* SyntaxKind.RegularExpressionLiteral */; @@ -435584,7 +436920,7 @@ var ts; (function (formatting) { function getAllRules() { var allTokens = []; - for (var token = 0 /* SyntaxKind.FirstToken */; token <= 160 /* SyntaxKind.LastToken */; token++) { + for (var token = 0 /* SyntaxKind.FirstToken */; token <= 162 /* SyntaxKind.LastToken */; token++) { if (token !== 1 /* SyntaxKind.EndOfFileToken */) { allTokens.push(token); } @@ -435599,9 +436935,9 @@ var ts; var anyToken = { tokens: allTokens, isSpecific: false }; var anyTokenIncludingMultilineComments = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [3 /* SyntaxKind.MultiLineCommentTrivia */], false)); var anyTokenIncludingEOF = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [1 /* SyntaxKind.EndOfFileToken */], false)); - var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 160 /* SyntaxKind.LastKeyword */); + var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 162 /* SyntaxKind.LastKeyword */); var binaryOperators = tokenRangeFromRange(29 /* SyntaxKind.FirstBinaryOperator */, 78 /* SyntaxKind.LastBinaryOperator */); - var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 160 /* SyntaxKind.OfKeyword */, 127 /* SyntaxKind.AsKeyword */, 139 /* SyntaxKind.IsKeyword */]; + var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 162 /* SyntaxKind.OfKeyword */, 128 /* SyntaxKind.AsKeyword */, 140 /* SyntaxKind.IsKeyword */]; var unaryPrefixOperators = [45 /* SyntaxKind.PlusPlusToken */, 46 /* SyntaxKind.MinusMinusToken */, 54 /* SyntaxKind.TildeToken */, 53 /* SyntaxKind.ExclamationToken */]; var unaryPrefixExpressions = [ 8 /* SyntaxKind.NumericLiteral */, 9 /* SyntaxKind.BigIntLiteral */, 79 /* SyntaxKind.Identifier */, 20 /* SyntaxKind.OpenParenToken */, @@ -435632,7 +436968,7 @@ var ts; rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */), // in other cases there should be no space between '?' and next token rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnIntegerLiteral], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */), // Special handling of unary operators. @@ -435675,11 +437011,11 @@ var ts; // Though, we do extra check on the context to make sure we are dealing with get/set node. Example: // get x() {} // set x(val) {} - rule("SpaceAfterGetSetInMember", [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterGetSetInMember", [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenYieldKeywordAndStar", 125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 16 /* RuleAction.DeleteSpace */), rule("SpaceBetweenYieldOrYieldStarAndOperand", [125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenReturnAndSemicolon", 105 /* SyntaxKind.ReturnKeyword */, 26 /* SyntaxKind.SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 132 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 133 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterLetConstInVariableDeclaration", [119 /* SyntaxKind.LetKeyword */, 85 /* SyntaxKind.ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 16 /* RuleAction.DeleteSpace */), // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. @@ -435687,8 +437023,8 @@ var ts; rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterVoidOperator", 114 /* SyntaxKind.VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 4 /* RuleAction.InsertSpace */), // Async-await - rule("SpaceBetweenAsyncAndOpenParen", 131 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBetweenAsyncAndFunctionKeyword", 131 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndOpenParen", 132 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndFunctionKeyword", 132 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Template string rule("NoSpaceBetweenTagAndTemplateString", [79 /* SyntaxKind.Identifier */, 21 /* SyntaxKind.CloseParenToken */], [14 /* SyntaxKind.NoSubstitutionTemplateLiteral */, 15 /* SyntaxKind.TemplateHead */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // JSX opening elements @@ -435699,34 +437035,35 @@ var ts; rule("NoSpaceAfterEqualInJsxAttribute", 63 /* SyntaxKind.EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // TypeScript-specific rules // Use of module as a function call. e.g.: import m2 = module("m2"); - rule("NoSpaceAfterModuleImport", [141 /* SyntaxKind.ModuleKeyword */, 146 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceAfterModuleImport", [142 /* SyntaxKind.ModuleKeyword */, 147 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // Add a space around certain TypeScript keywords rule("SpaceAfterCertainTypeScriptKeywords", [ 126 /* SyntaxKind.AbstractKeyword */, + 127 /* SyntaxKind.AccessorKeyword */, 84 /* SyntaxKind.ClassKeyword */, - 135 /* SyntaxKind.DeclareKeyword */, + 136 /* SyntaxKind.DeclareKeyword */, 88 /* SyntaxKind.DefaultKeyword */, 92 /* SyntaxKind.EnumKeyword */, 93 /* SyntaxKind.ExportKeyword */, 94 /* SyntaxKind.ExtendsKeyword */, - 136 /* SyntaxKind.GetKeyword */, + 137 /* SyntaxKind.GetKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 100 /* SyntaxKind.ImportKeyword */, 118 /* SyntaxKind.InterfaceKeyword */, - 141 /* SyntaxKind.ModuleKeyword */, - 142 /* SyntaxKind.NamespaceKeyword */, + 142 /* SyntaxKind.ModuleKeyword */, + 143 /* SyntaxKind.NamespaceKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 123 /* SyntaxKind.PublicKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 151 /* SyntaxKind.SetKeyword */, 124 /* SyntaxKind.StaticKeyword */, - 152 /* SyntaxKind.TypeKeyword */, - 156 /* SyntaxKind.FromKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 137 /* SyntaxKind.InferKeyword */, + 154 /* SyntaxKind.TypeKeyword */, + 158 /* SyntaxKind.FromKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 138 /* SyntaxKind.InferKeyword */, ], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 156 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 158 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { rule("SpaceAfterModuleName", 10 /* SyntaxKind.StringLiteral */, 18 /* SyntaxKind.OpenBraceToken */, [isModuleDeclContext], 4 /* RuleAction.InsertSpace */), // Lambda expressions @@ -435757,8 +437094,8 @@ var ts; 123 /* SyntaxKind.PublicKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 136 /* SyntaxKind.GetKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 137 /* SyntaxKind.GetKeyword */, + 151 /* SyntaxKind.SetKeyword */, 22 /* SyntaxKind.OpenBracketToken */, 41 /* SyntaxKind.AsteriskToken */, ], [isEndOfDecoratorContextOnSameLine], 4 /* RuleAction.InsertSpace */), @@ -435769,8 +437106,8 @@ var ts; // These rules are applied after high priority var userConfigurableRules = [ // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - rule("SpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("NoSpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("SpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("NoSpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket, isNextTokenNotCloseParen], 4 /* RuleAction.InsertSpace */), rule("NoSpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 16 /* RuleAction.DeleteSpace */), // Insert space after function keyword for anonymous functions @@ -435844,11 +437181,11 @@ var ts; rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* SyntaxKind.OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* RuleAction.InsertSpace */, 1 /* RuleFlags.CanDeleteNewLines */), rule("NoSpaceBeforeComma", anyToken, 27 /* SyntaxKind.CommaToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // No space before and after indexer `x[]` - rule("NoSpaceBeforeOpenBracket", anyTokenExcept(131 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeOpenBracket", anyTokenExcept(132 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterCloseBracket", 23 /* SyntaxKind.CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterSemicolon", 26 /* SyntaxKind.SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Remove extra space between for and await - rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 132 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 133 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] rule("SpaceBetweenStatements", [21 /* SyntaxKind.CloseParenToken */, 90 /* SyntaxKind.DoKeyword */, 91 /* SyntaxKind.ElseKeyword */, 82 /* SyntaxKind.CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 4 /* RuleAction.InsertSpace */), @@ -435897,69 +437234,70 @@ var ts; return function (context) { return context.options && context.options[optionName] === optionValue; }; } function isOptionEnabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; }; } function isOptionDisabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; }; } function isOptionDisabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; }; } function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; } function isOptionEnabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 242 /* SyntaxKind.ForStatement */; + return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return context.contextNode.operatorToken.kind !== 27 /* SyntaxKind.CommaToken */; - case 222 /* SyntaxKind.ConditionalExpression */: - case 189 /* SyntaxKind.ConditionalType */: - case 229 /* SyntaxKind.AsExpression */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 177 /* SyntaxKind.TypePredicate */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 191 /* SyntaxKind.ConditionalType */: + case 231 /* SyntaxKind.AsExpression */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 179 /* SyntaxKind.TypePredicate */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // equals in type X = ... // falls through - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // equal in import a = module('a'); // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // equal in export = 1 // falls through - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // equal in let a = 0 // falls through - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // equal in p = 0 // falls through - case 164 /* SyntaxKind.Parameter */: - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // "in" keyword in for (let x in []) { } - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // "in" keyword in [P in keyof T]: T[P] // falls through - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return context.currentTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.nextTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 244 /* SyntaxKind.ForOfStatement */: - return context.currentTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */; + case 247 /* SyntaxKind.ForOfStatement */: + return context.currentTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */; } return false; } @@ -435971,22 +437309,22 @@ var ts; } function isTypeAnnotationContext(context) { var contextKind = context.contextNode.kind; - return contextKind === 167 /* SyntaxKind.PropertyDeclaration */ || - contextKind === 166 /* SyntaxKind.PropertySignature */ || - contextKind === 164 /* SyntaxKind.Parameter */ || - contextKind === 254 /* SyntaxKind.VariableDeclaration */ || + return contextKind === 169 /* SyntaxKind.PropertyDeclaration */ || + contextKind === 168 /* SyntaxKind.PropertySignature */ || + contextKind === 166 /* SyntaxKind.Parameter */ || + contextKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 222 /* SyntaxKind.ConditionalExpression */ || - context.contextNode.kind === 189 /* SyntaxKind.ConditionalType */; + return context.contextNode.kind === 224 /* SyntaxKind.ConditionalExpression */ || + context.contextNode.kind === 191 /* SyntaxKind.ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || - context.contextNode.kind === 195 /* SyntaxKind.MappedType */ || + return context.contextNode.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || + context.contextNode.kind === 197 /* SyntaxKind.MappedType */ || isSingleLineBlockContext(context); } // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -436012,34 +437350,34 @@ var ts; return true; } switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 265 /* SyntaxKind.ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: // falls through - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // case SyntaxKind.MethodSignature: // falls through - case 174 /* SyntaxKind.CallSignature */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 258 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 261 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -436048,40 +437386,40 @@ var ts; return !isFunctionDeclContext(context); } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 256 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 213 /* SyntaxKind.FunctionExpression */; + return context.contextNode.kind === 259 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 215 /* SyntaxKind.FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 273 /* SyntaxKind.NamedExports */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 269 /* SyntaxKind.NamedImports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 276 /* SyntaxKind.NamedExports */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 272 /* SyntaxKind.NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 292 /* SyntaxKind.CatchClause */: - case 262 /* SyntaxKind.ModuleBlock */: - case 249 /* SyntaxKind.SwitchStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 295 /* SyntaxKind.CatchClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 252 /* SyntaxKind.SwitchStatement */: return true; - case 235 /* SyntaxKind.Block */: { + case 238 /* SyntaxKind.Block */: { var blockParent = context.currentTokenParent.parent; // In a codefix scenario, we can't rely on parents being set. So just always return true. - if (!blockParent || blockParent.kind !== 214 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (!blockParent || blockParent.kind !== 216 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 215 /* SyntaxKind.FunctionExpression */) { return true; } } @@ -436090,32 +437428,32 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 248 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 251 /* SyntaxKind.WithStatement */: // TODO // case SyntaxKind.ElseClause: // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return context.contextNode.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 208 /* SyntaxKind.CallExpression */; + return context.contextNode.kind === 210 /* SyntaxKind.CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 209 /* SyntaxKind.NewExpression */; + return context.contextNode.kind === 211 /* SyntaxKind.NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -436130,10 +437468,10 @@ var ts; return context.nextTokenSpan.kind !== 21 /* SyntaxKind.CloseParenToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 214 /* SyntaxKind.ArrowFunction */; + return context.contextNode.kind === 216 /* SyntaxKind.ArrowFunction */; } function isImportTypeContext(context) { - return context.contextNode.kind === 200 /* SyntaxKind.ImportType */; + return context.contextNode.kind === 202 /* SyntaxKind.ImportType */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; @@ -436142,19 +437480,19 @@ var ts; return context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 278 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 282 /* SyntaxKind.JsxFragment */; + return context.contextNode.kind !== 281 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 285 /* SyntaxKind.JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 288 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return context.contextNode.kind === 291 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.nextTokenParent.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.contextNode.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return context.contextNode.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -436166,48 +437504,48 @@ var ts; !nodeIsInDecoratorContext(context.nextTokenParent); } function nodeIsInDecoratorContext(node) { - while (ts.isExpressionNode(node)) { + while (node && ts.isExpression(node)) { node = node.parent; } - return node.kind === 165 /* SyntaxKind.Decorator */; + return node && node.kind === 167 /* SyntaxKind.Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 255 /* SyntaxKind.VariableDeclarationList */ && + return context.currentTokenParent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormattingRequestKind.FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return context.contextNode.kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isObjectTypeContext(context) { - return context.contextNode.kind === 182 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 184 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; } function isConstructorSignatureContext(context) { - return context.contextNode.kind === 175 /* SyntaxKind.ConstructSignature */; + return context.contextNode.kind === 177 /* SyntaxKind.ConstructSignature */; } function isTypeArgumentOrParameterOrAssertion(token, parent) { if (token.kind !== 29 /* SyntaxKind.LessThanToken */ && token.kind !== 31 /* SyntaxKind.GreaterThanToken */) { return false; } switch (parent.kind) { - case 178 /* SyntaxKind.TypeReference */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return true; default: return false; @@ -436218,28 +437556,28 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return context.contextNode.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 217 /* SyntaxKind.VoidExpression */; + return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 219 /* SyntaxKind.VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 224 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 226 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 230 /* SyntaxKind.NonNullExpression */; + return context.contextNode.kind === 232 /* SyntaxKind.NonNullExpression */; } function isNotStatementConditionContext(context) { return !isStatementConditionContext(context); } function isStatementConditionContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; default: return false; @@ -436264,12 +437602,12 @@ var ts; return nextTokenKind === 19 /* SyntaxKind.CloseBraceToken */ || nextTokenKind === 1 /* SyntaxKind.EndOfFileToken */; } - if (nextTokenKind === 234 /* SyntaxKind.SemicolonClassElement */ || + if (nextTokenKind === 237 /* SyntaxKind.SemicolonClassElement */ || nextTokenKind === 26 /* SyntaxKind.SemicolonToken */) { return false; } - if (context.contextNode.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - context.contextNode.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (context.contextNode.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + context.contextNode.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Can’t remove semicolon after `foo`; it would parse as a method declaration: // // interface I { @@ -436283,9 +437621,9 @@ var ts; if (ts.isPropertyDeclaration(context.currentTokenParent)) { return !context.currentTokenParent.initializer; } - return context.currentTokenParent.kind !== 242 /* SyntaxKind.ForStatement */ - && context.currentTokenParent.kind !== 236 /* SyntaxKind.EmptyStatement */ - && context.currentTokenParent.kind !== 234 /* SyntaxKind.SemicolonClassElement */ + return context.currentTokenParent.kind !== 245 /* SyntaxKind.ForStatement */ + && context.currentTokenParent.kind !== 239 /* SyntaxKind.EmptyStatement */ + && context.currentTokenParent.kind !== 237 /* SyntaxKind.SemicolonClassElement */ && nextTokenKind !== 22 /* SyntaxKind.OpenBracketToken */ && nextTokenKind !== 20 /* SyntaxKind.OpenParenToken */ && nextTokenKind !== 39 /* SyntaxKind.PlusToken */ @@ -436293,7 +437631,7 @@ var ts; && nextTokenKind !== 43 /* SyntaxKind.SlashToken */ && nextTokenKind !== 13 /* SyntaxKind.RegularExpressionLiteral */ && nextTokenKind !== 27 /* SyntaxKind.CommaToken */ - && nextTokenKind !== 223 /* SyntaxKind.TemplateExpression */ + && nextTokenKind !== 225 /* SyntaxKind.TemplateExpression */ && nextTokenKind !== 15 /* SyntaxKind.TemplateHead */ && nextTokenKind !== 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */ && nextTokenKind !== 24 /* SyntaxKind.DotToken */; @@ -436301,6 +437639,11 @@ var ts; function isSemicolonInsertionContext(context) { return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); } + function isNotPropertyAccessOnIntegerLiteral(context) { + return !ts.isPropertyAccessExpression(context.contextNode) + || !ts.isNumericLiteral(context.contextNode.expression) + || context.contextNode.expression.getText().indexOf(".") !== -1; + } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /* @internal */ @@ -436384,12 +437727,12 @@ var ts; return map; } function getRuleBucketIndex(row, column) { - ts.Debug.assert(row <= 160 /* SyntaxKind.LastKeyword */ && column <= 160 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 162 /* SyntaxKind.LastKeyword */ && column <= 162 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); return (row * mapRowLength) + column; } var maskBitSize = 5; var mask = 31; // MaskBitSize bits - var mapRowLength = 160 /* SyntaxKind.LastToken */ + 1; + var mapRowLength = 162 /* SyntaxKind.LastToken */ + 1; var RulesPosition; (function (RulesPosition) { RulesPosition[RulesPosition["StopRulesSpecific"] = 0] = "StopRulesSpecific"; @@ -436577,17 +437920,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var body = parent.body; - return !!body && body.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + return !!body && body.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -436850,19 +438193,19 @@ var ts; return modifier.kind; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; - case 256 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; - case 260 /* SyntaxKind.EnumDeclaration */: return 260 /* SyntaxKind.EnumDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: return 136 /* SyntaxKind.GetKeyword */; - case 173 /* SyntaxKind.SetAccessor */: return 149 /* SyntaxKind.SetKeyword */; - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; + case 261 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; + case 259 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; + case 263 /* SyntaxKind.EnumDeclaration */: return 263 /* SyntaxKind.EnumDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: return 137 /* SyntaxKind.GetKeyword */; + case 175 /* SyntaxKind.SetAccessor */: return 151 /* SyntaxKind.SetKeyword */; + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { return 41 /* SyntaxKind.AsteriskToken */; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: var name = ts.getNameOfDeclaration(node); if (name) { return name.kind; @@ -436919,15 +438262,15 @@ var ts; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: switch (container.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return false; } break; case 22 /* SyntaxKind.OpenBracketToken */: case 23 /* SyntaxKind.CloseBracketToken */: - if (container.kind !== 195 /* SyntaxKind.MappedType */) { + if (container.kind !== 197 /* SyntaxKind.MappedType */) { return false; } break; @@ -437031,11 +438374,11 @@ var ts; return inheritedIndentation; } } - var effectiveParentStartLine = child.kind === 165 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 167 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { + if (isFirstListItem && parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -437493,18 +438836,18 @@ var ts; formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; function getOpenTokenForList(node, list) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -437512,8 +438855,8 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -437521,24 +438864,24 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 178 /* SyntaxKind.TypeReference */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 181 /* SyntaxKind.TypeQuery */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 200 /* SyntaxKind.ImportType */: + case 180 /* SyntaxKind.TypeReference */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 183 /* SyntaxKind.TypeQuery */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 202 /* SyntaxKind.ImportType */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return 18 /* SyntaxKind.OpenBraceToken */; } return 0 /* SyntaxKind.Unknown */; @@ -437674,11 +439017,11 @@ var ts; // y: undefined, // } // ``` - var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; if (options.indentStyle === ts.IndentStyle.Block || isObjectLiteral) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Value.Unknown */) { @@ -437688,7 +439031,7 @@ var ts; var containerList = getListByPosition(position, precedingToken.parent, sourceFile); // use list position if the preceding token is before any list items if (containerList && !ts.rangeContainsRange(containerList, precedingToken)) { - var useTheSameBaseIndentation = [213 /* SyntaxKind.FunctionExpression */, 214 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; + var useTheSameBaseIndentation = [215 /* SyntaxKind.FunctionExpression */, 216 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; var indentSize = useTheSameBaseIndentation ? 0 : options.indentSize; return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; // TODO: GH#18217 } @@ -437853,7 +439196,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 305 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); + (parent.kind === 308 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Value.Unknown */; } @@ -437901,7 +439244,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 239 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 242 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 91 /* SyntaxKind.ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -437982,42 +439325,42 @@ var ts; } function getListByRange(start, end, node, sourceFile) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getList(node.typeArguments); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return getList(node.properties); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getList(node.elements); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return getList(node.members); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return getList(node.typeParameters) || getList(node.parameters); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return getList(node.parameters); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return getList(node.typeParameters); - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: return getList(node.typeArguments) || getList(node.arguments); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return getList(node.declarations); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return getList(node.elements); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return getList(node.elements); } function getList(list) { @@ -438040,7 +439383,7 @@ var ts; return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); } function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { - if (node.parent && node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.parent && node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // VariableDeclarationList has no wrapping tokens return -1 /* Value.Unknown */; } @@ -438113,96 +439456,96 @@ var ts; function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* SyntaxKind.Unknown */; switch (parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 195 /* SyntaxKind.MappedType */: - case 184 /* SyntaxKind.TupleType */: - case 263 /* SyntaxKind.CaseBlock */: - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 237 /* SyntaxKind.VariableStatement */: - case 271 /* SyntaxKind.ExportAssignment */: - case 247 /* SyntaxKind.ReturnStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 288 /* SyntaxKind.JsxExpression */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 164 /* SyntaxKind.Parameter */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 273 /* SyntaxKind.NamedExports */: - case 269 /* SyntaxKind.NamedImports */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 197 /* SyntaxKind.MappedType */: + case 186 /* SyntaxKind.TupleType */: + case 266 /* SyntaxKind.CaseBlock */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 240 /* SyntaxKind.VariableStatement */: + case 274 /* SyntaxKind.ExportAssignment */: + case 250 /* SyntaxKind.ReturnStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 291 /* SyntaxKind.JsxExpression */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 166 /* SyntaxKind.Parameter */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 276 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: - if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 205 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 + case 257 /* SyntaxKind.VariableDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 return rangeIsOnOneLine(sourceFile, child); } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 278 /* SyntaxKind.JsxElement */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 281 /* SyntaxKind.JsxElement */) { var parentStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, parent.pos)).line; var childStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, child.pos)).line; return parentStartLine !== childStartLine; } - if (parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { return true; } break; - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return childKind !== 235 /* SyntaxKind.Block */; - case 214 /* SyntaxKind.ArrowFunction */: - if (sourceFile && childKind === 212 /* SyntaxKind.ParenthesizedExpression */) { + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return childKind !== 238 /* SyntaxKind.Block */; + case 216 /* SyntaxKind.ArrowFunction */: + if (sourceFile && childKind === 214 /* SyntaxKind.ParenthesizedExpression */) { return rangeIsOnOneLine(sourceFile, child); } - return childKind !== 235 /* SyntaxKind.Block */; - case 272 /* SyntaxKind.ExportDeclaration */: - return childKind !== 273 /* SyntaxKind.NamedExports */; - case 266 /* SyntaxKind.ImportDeclaration */: - return childKind !== 267 /* SyntaxKind.ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 269 /* SyntaxKind.NamedImports */); - case 278 /* SyntaxKind.JsxElement */: - return childKind !== 281 /* SyntaxKind.JsxClosingElement */; - case 282 /* SyntaxKind.JsxFragment */: - return childKind !== 284 /* SyntaxKind.JsxClosingFragment */; - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: - if (childKind === 182 /* SyntaxKind.TypeLiteral */ || childKind === 184 /* SyntaxKind.TupleType */) { + return childKind !== 238 /* SyntaxKind.Block */; + case 275 /* SyntaxKind.ExportDeclaration */: + return childKind !== 276 /* SyntaxKind.NamedExports */; + case 269 /* SyntaxKind.ImportDeclaration */: + return childKind !== 270 /* SyntaxKind.ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 272 /* SyntaxKind.NamedImports */); + case 281 /* SyntaxKind.JsxElement */: + return childKind !== 284 /* SyntaxKind.JsxClosingElement */; + case 285 /* SyntaxKind.JsxFragment */: + return childKind !== 287 /* SyntaxKind.JsxClosingFragment */; + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + if (childKind === 184 /* SyntaxKind.TypeLiteral */ || childKind === 186 /* SyntaxKind.TupleType */) { return false; } break; @@ -438213,11 +439556,11 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return parent.kind !== 235 /* SyntaxKind.Block */; + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + return parent.kind !== 238 /* SyntaxKind.Block */; default: return false; } @@ -438434,7 +439777,7 @@ var ts; * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element */ function isSeparator(node, candidate) { - return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)); + return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)); } function isThisTypeAnnotatable(containingFunction) { return ts.isFunctionExpression(containingFunction) || ts.isFunctionDeclaration(containingFunction); @@ -438666,7 +440009,7 @@ var ts; } } else { - endNode = (_a = (node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; + endNode = (_a = (node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; } this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); return true; @@ -438832,18 +440175,18 @@ var ts; }; ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: case 10 /* SyntaxKind.StringLiteral */: case 79 /* SyntaxKind.Identifier */: return { prefix: ", " }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return { suffix: "," + this.newLineCharacter }; case 93 /* SyntaxKind.ExportKeyword */: return { prefix: " " }; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return {}; default: ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it @@ -438852,7 +440195,7 @@ var ts; }; ChangeTracker.prototype.insertName = function (sourceFile, node, name) { ts.Debug.assert(!node.name); - if (node.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind === 216 /* SyntaxKind.ArrowFunction */) { var arrow = ts.findChildOfKind(node, 38 /* SyntaxKind.EqualsGreaterThanToken */, sourceFile); var lparen = ts.findChildOfKind(node, 20 /* SyntaxKind.OpenParenToken */, sourceFile); if (lparen) { @@ -438866,14 +440209,14 @@ var ts; // Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)` this.replaceRange(sourceFile, arrow, ts.factory.createToken(21 /* SyntaxKind.CloseParenToken */)); } - if (node.body.kind !== 235 /* SyntaxKind.Block */) { + if (node.body.kind !== 238 /* SyntaxKind.Block */) { // `() => 0` => `function f() { return 0; }` this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.factory.createToken(18 /* SyntaxKind.OpenBraceToken */), ts.factory.createToken(105 /* SyntaxKind.ReturnKeyword */)], { joiner: " ", suffix: " " }); this.insertNodesAt(sourceFile, node.body.end, [ts.factory.createToken(26 /* SyntaxKind.SemicolonToken */), ts.factory.createToken(19 /* SyntaxKind.CloseBraceToken */)], { joiner: " " }); } } else { - var pos = ts.findChildOfKind(node, node.kind === 213 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; + var pos = ts.findChildOfKind(node, node.kind === 215 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; this.insertNodeAt(sourceFile, pos, ts.factory.createIdentifier(name), { prefix: " " }); } }; @@ -439050,10 +440393,10 @@ var ts; }()); textChanges_3.ChangeTracker = ChangeTracker; function updateJSDocHost(parent) { - if (parent.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (parent.kind !== 216 /* SyntaxKind.ArrowFunction */) { return parent; } - var jsDocNode = parent.parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ ? + var jsDocNode = parent.parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ ? parent.parent : parent.parent.parent; jsDocNode.jsDoc = parent.jsDoc; @@ -439065,16 +440408,16 @@ var ts; return undefined; } switch (oldTag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 343 /* SyntaxKind.JSDocParameterTag */: { var oldParam = oldTag; var newParam = newTag; return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? ts.factory.createJSDocParameterTag(/*tagName*/ undefined, newParam.name, /*isBracketed*/ false, newParam.typeExpression, newParam.isNameFirst, oldParam.comment) : undefined; } - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: return ts.factory.createJSDocReturnTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return ts.factory.createJSDocTypeTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); } } @@ -439082,6 +440425,26 @@ var ts; function startPositionToDeleteNodeInList(sourceFile, node) { return ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.IncludeAll }), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); } + function endPositionToDeleteNodeInList(sourceFile, node, prevNode, nextNode) { + var end = startPositionToDeleteNodeInList(sourceFile, nextNode); + if (prevNode === undefined || ts.positionsAreOnSameLine(getAdjustedEndPosition(sourceFile, node, {}), end, sourceFile)) { + return end; + } + var token = ts.findPrecedingToken(nextNode.getStart(sourceFile), sourceFile); + if (isSeparator(node, token)) { + var prevToken = ts.findPrecedingToken(node.getStart(sourceFile), sourceFile); + if (isSeparator(prevNode, prevToken)) { + var pos = ts.skipTrivia(sourceFile.text, token.getEnd(), /*stopAfterLineBreak*/ true, /*stopAtComments*/ true); + if (ts.positionsAreOnSameLine(prevToken.getStart(sourceFile), token.getStart(sourceFile), sourceFile)) { + return ts.isLineBreak(sourceFile.text.charCodeAt(pos - 1)) ? pos - 1 : pos; + } + if (ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + return pos; + } + } + } + return end; + } function getClassOrObjectBraceEnds(cls, sourceFile) { var open = ts.findChildOfKind(cls, 18 /* SyntaxKind.OpenBraceToken */, sourceFile); var close = ts.findChildOfKind(cls, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); @@ -439468,14 +440831,14 @@ var ts; } textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment; function needSemicolonBetween(a, b) { - return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[` } var deleteDeclaration; (function (deleteDeclaration_1) { function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: { + case 166 /* SyntaxKind.Parameter */: { var oldFunction = node.parent; if (ts.isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && @@ -439490,17 +440853,17 @@ var ts; } break; } - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var isFirstImport = sourceFile.imports.length && node === ts.first(sourceFile.imports).parent || node === ts.find(sourceFile.statements, ts.isAnyImportSyntax); // For first import, leave header comment in place, otherwise only delete JSDoc comments deleteNode(changes, sourceFile, node, { leadingTriviaOption: isFirstImport ? LeadingTriviaOption.Exclude : ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine, }); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: var pattern = node.parent; - var preserveComma = pattern.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); + var preserveComma = pattern.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } @@ -439508,13 +440871,13 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: var namedImports = node.parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); @@ -439523,7 +440886,7 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: deleteImportBinding(changes, sourceFile, node); break; case 26 /* SyntaxKind.SemicolonToken */: @@ -439532,8 +440895,8 @@ var ts; case 98 /* SyntaxKind.FunctionKeyword */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.Exclude }); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -439584,13 +440947,13 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(node, 266 /* SyntaxKind.ImportDeclaration */); + var importDecl = ts.getAncestor(node, 269 /* SyntaxKind.ImportDeclaration */); deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { var parent = node.parent; - if (parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (parent.kind === 295 /* SyntaxKind.CatchClause */) { // TODO: There's currently no unused diagnostic for this, could be a suggestion changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* SyntaxKind.OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* SyntaxKind.CloseParenToken */, sourceFile)); return; @@ -439601,14 +440964,14 @@ var ts; } var gp = parent.parent; switch (gp.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: changes.replaceNode(sourceFile, node, ts.factory.createObjectLiteralExpression()); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: deleteNode(changes, sourceFile, parent); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: deleteNode(changes, sourceFile, gp, { leadingTriviaOption: ts.hasJSDocNodes(gp) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -439639,7 +441002,7 @@ var ts; deletedNodesInLists.add(node); changes.deleteRange(sourceFile, { pos: startPositionToDeleteNodeInList(sourceFile, node), - end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : startPositionToDeleteNodeInList(sourceFile, containingList[index + 1]), + end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : endPositionToDeleteNodeInList(sourceFile, node, containingList[index - 1], containingList[index + 1]), }); } })(textChanges = ts.textChanges || (ts.textChanges = {})); @@ -439795,8 +441158,8 @@ var ts; }); function makeChange(changeTracker, sourceFile, assertion) { var replacement = ts.isAsExpression(assertion) - ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)) - : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), assertion.expression); + ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)) + : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), assertion.expression); changeTracker.replaceNode(sourceFile, assertion.expression, replacement); } function getAssertion(sourceFile, pos) { @@ -439880,7 +441243,7 @@ var ts; } } fixedDeclarations === null || fixedDeclarations === void 0 ? void 0 : fixedDeclarations.add(ts.getNodeId(insertionSite)); - var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 256 /* ModifierFlags.Async */))); + var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 512 /* ModifierFlags.Async */))); changeTracker.replaceNode(sourceFile, insertionSite, cloneWithModifier); } function getFixableErrorSpanDeclaration(sourceFile, span) { @@ -439926,7 +441289,7 @@ var ts; ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code, - ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code, + ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap.code, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code, ts.Diagnostics.Type_0_is_not_an_array_type.code, ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code, @@ -440024,7 +441387,7 @@ var ts; } var declaration = ts.tryCast(symbol.valueDeclaration, ts.isVariableDeclaration); var variableName = declaration && ts.tryCast(declaration.name, ts.isIdentifier); - var variableStatement = ts.getAncestor(declaration, 237 /* SyntaxKind.VariableStatement */); + var variableStatement = ts.getAncestor(declaration, 240 /* SyntaxKind.VariableStatement */); if (!declaration || !variableStatement || declaration.type || !declaration.initializer || @@ -440102,13 +441465,22 @@ var ts; function isInsideAwaitableBody(node) { return node.kind & 32768 /* NodeFlags.AwaitContext */ || !!ts.findAncestor(node, function (ancestor) { return ancestor.parent && ts.isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || - ts.isBlock(ancestor) && (ancestor.parent.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - ancestor.parent.kind === 213 /* SyntaxKind.FunctionExpression */ || - ancestor.parent.kind === 214 /* SyntaxKind.ArrowFunction */ || - ancestor.parent.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.isBlock(ancestor) && (ancestor.parent.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + ancestor.parent.kind === 215 /* SyntaxKind.FunctionExpression */ || + ancestor.parent.kind === 216 /* SyntaxKind.ArrowFunction */ || + ancestor.parent.kind === 171 /* SyntaxKind.MethodDeclaration */); }); } function makeChange(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) { + if (ts.isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) { + var exprType = checker.getTypeAtLocation(insertionSite); + var asyncIter = checker.getAsyncIterableType(); + if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) { + var forOf = insertionSite.parent; + changeTracker.replaceNode(sourceFile, forOf, ts.factory.updateForOfStatement(forOf, ts.factory.createToken(133 /* SyntaxKind.AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement)); + return; + } + } if (ts.isBinaryExpression(insertionSite)) { for (var _i = 0, _a = [insertionSite.left, insertionSite.right]; _i < _a.length; _i++) { var side = _a[_i]; @@ -440224,10 +441596,10 @@ var ts; function isPossiblyPartOfDestructuring(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return true; default: return false; @@ -440242,7 +441614,7 @@ var ts; function isPossiblyPartOfCommaSeperatedInitializer(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: case 27 /* SyntaxKind.CommaToken */: return true; default: @@ -440291,9 +441663,9 @@ var ts; return; } var declaration = token.parent; - if (declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + if (declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && (!fixedNodes || ts.tryAddToSet(fixedNodes, declaration))) { - changeTracker.insertModifierBefore(sourceFile, 135 /* SyntaxKind.DeclareKeyword */, declaration); + changeTracker.insertModifierBefore(sourceFile, 136 /* SyntaxKind.DeclareKeyword */, declaration); } } })(codefix = ts.codefix || (ts.codefix = {})); @@ -440447,7 +441819,7 @@ var ts; var add = toAdd_1[_i]; var d = add.valueDeclaration; if (d && (ts.isPropertySignature(d) || ts.isPropertyDeclaration(d)) && d.type) { - var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 187 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ + var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 189 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ ts.factory.createTypeReferenceNode("undefined") ], false)); changes.replaceNode(d.getSourceFile(), d.type, t); @@ -440527,26 +441899,26 @@ var ts; } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return ts.factory.createTypeReferenceNode("any", ts.emptyArray); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return transformJSDocOptionalType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return transformJSDocType(node.type); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return transformJSDocNullableType(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return transformJSDocVariadicType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return transformJSDocFunctionType(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return transformJSDocTypeReference(node); default: var visited = ts.visitEachChild(node, transformJSDocType, ts.nullTransformationContext); @@ -440567,11 +441939,11 @@ var ts; var _a; // TODO: This does not properly handle `function(new:C, string)` per https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System#the-javascript-type-language // however we do handle it correctly in `serializeTypeForDeclaration` in checker.ts - return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 318 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 + var isRest = node.type.kind === 321 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : node.dotDotDotToken; return ts.factory.createParameterDeclaration(node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -440610,8 +441982,8 @@ var ts; function transformJSDocIndexSignature(node) { var index = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "n" : "s", - /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), + /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "n" : "s", + /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), /*initializer*/ undefined); var indexSignature = ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature(/*modifiers*/ undefined, [index], node.typeArguments[1])]); ts.setEmitFlags(indexSignature, 1 /* EmitFlags.SingleLine */); @@ -440646,8 +442018,8 @@ var ts; return undefined; } var ctorDeclaration = ctorSymbol.valueDeclaration; - if (ts.isFunctionDeclaration(ctorDeclaration)) { - changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunctionDeclaration(ctorDeclaration)); + if (ts.isFunctionDeclaration(ctorDeclaration) || ts.isFunctionExpression(ctorDeclaration)) { + changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunction(ctorDeclaration)); } else if (ts.isVariableDeclaration(ctorDeclaration)) { var classDeclaration = createClassFromVariableDeclaration(ctorDeclaration); @@ -440751,7 +442123,7 @@ var ts; return; } // delete the entire statement if this expression is the sole expression to take care of the semicolon at the end - var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; changes.delete(sourceFile, nodeToDelete); if (!assignmentExpr) { @@ -440803,7 +442175,7 @@ var ts; return createArrowFunctionExpressionMember(members, expression, name); } function createFunctionExpressionMember(members, functionExpression, name) { - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -440814,14 +442186,14 @@ var ts; var arrowFunctionBody = arrowFunction.body; var bodyBlock; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 235 /* SyntaxKind.Block */) { + if (arrowFunctionBody.kind === 238 /* SyntaxKind.Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] else { bodyBlock = ts.factory.createBlock([ts.factory.createReturnStatement(arrowFunctionBody)]); } - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -440844,7 +442216,7 @@ var ts; // Don't call copyComments here because we'll already leave them in place return cls; } - function createClassFromFunctionDeclaration(node) { + function createClassFromFunction(node) { var memberElements = createClassElementsFromSymbol(ctorSymbol); if (node.body) { memberElements.unshift(ts.factory.createConstructorDeclaration(/*modifiers*/ undefined, node.parameters, node.body)); @@ -440934,7 +442306,7 @@ var ts; return; } var pos = ts.skipTrivia(sourceFile.text, ts.moveRangePastModifiers(functionToConvert).pos); - changes.insertModifierAt(sourceFile, pos, 131 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); + changes.insertModifierAt(sourceFile, pos, 132 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); var _loop_12 = function (returnStatement) { ts.forEachChild(returnStatement, function visit(node) { if (ts.isCallExpression(node)) { @@ -441340,7 +442712,7 @@ var ts; case 104 /* SyntaxKind.NullKeyword */: // do not produce a transformed statement for a null argument break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 79 /* SyntaxKind.Identifier */: // identifier includes undefined if (!inputArgName) { // undefined was argument passed to promise handler @@ -441362,8 +442734,8 @@ var ts; continuationArgName.types.push(transformer.checker.getAwaitedType(returnType) || returnType); } return varDeclOrAssignment; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: { + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: { var funcBody = func.body; var returnType_1 = (_a = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) === null || _a === void 0 ? void 0 : _a.getReturnType(); // Arrow functions with block bodies { } will enter this control flow @@ -441532,7 +442904,7 @@ var ts; name = getMapEntryOrDefault(funcNode.name); } // return undefined argName when arg is null or undefined - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!name || "identifier" in name && name.identifier.text === "undefined") { return undefined; } @@ -441641,10 +443013,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.factory.createPropertyAccessExpression(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -441711,20 +443083,20 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, useSitesToUnqualify, quotePreference) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); return false; - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference)); } return false; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var operatorToken = expression.operatorToken; return operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports, useSitesToUnqualify); } @@ -441773,8 +443145,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return convertedImports([ @@ -441825,16 +443197,16 @@ var ts; function tryChangeModuleExportsObject(object, useSitesToUnqualify) { var statements = ts.mapAllOrFail(object.properties, function (prop) { switch (prop.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. // falls through - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return undefined; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)], prop, useSitesToUnqualify); default: ts.Debug.assertNever(prop, "Convert to ES6 got invalid prop kind ".concat(prop.kind)); @@ -441898,7 +443270,7 @@ var ts; function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualify) { var modifiers = [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)]; switch (exported.kind) { - case 213 /* SyntaxKind.FunctionExpression */: { + case 215 /* SyntaxKind.FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -441906,10 +443278,10 @@ var ts; } } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); default: @@ -441929,7 +443301,7 @@ var ts; : ts.getSynthesizedDeepCloneWithReplacements(nodeOrNodes, /*includeTrivia*/ true, replaceNode); function replaceNode(original) { // We are replacing `mod.SomeExport` wih `SomeExport`, so we only need to look at PropertyAccessExpressions - if (original.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (original.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var replacement = useSitesToUnqualify.get(original); // Remove entry from `useSitesToUnqualify` so the refactor knows it's taken care of by the parent statement we're replacing useSitesToUnqualify.delete(original); @@ -441944,7 +443316,7 @@ var ts; */ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) { return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name) ? undefined @@ -441955,7 +443327,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 204 /* SyntaxKind.ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -442048,11 +443420,11 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return parent.propertyName !== node; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return parent.propertyName !== node; default: return true; @@ -442163,7 +443535,7 @@ var ts; var exportDeclaration = exportClause.parent; var typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); if (typeExportSpecifiers.length === exportClause.elements.length) { - changes.insertModifierBefore(context.sourceFile, 152 /* SyntaxKind.TypeKeyword */, exportClause); + changes.insertModifierBefore(context.sourceFile, 154 /* SyntaxKind.TypeKeyword */, exportClause); } else { var valueExportDeclaration = ts.factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, @@ -442399,27 +443771,29 @@ var ts; errorCodes: errorCodes, getCodeActions: function (context) { var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program; - var info = getFixesInfo(context, errorCode, span.start, /*useAutoImportProvider*/ true); + var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true); if (!info) return undefined; - var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix, - /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); }); + return info.map(function (_a) { + var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText; + return codeActionForFix(context, sourceFile, symbolName, fix, + /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); + }); }, fixIds: [importFixId], getAllCodeActions: function (context) { - var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host; - var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host); + var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host, cancellationToken = context.cancellationToken; + var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host, cancellationToken); codefix.eachDiagnostic(context, errorCodes, function (diag) { return importAdder.addImportFromDiagnostic(diag, context); }); return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, importAdder.writeFixes)); }, }); - function createImportAdder(sourceFile, program, preferences, host) { - return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host); + function createImportAdder(sourceFile, program, preferences, host, cancellationToken) { + return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host, cancellationToken); } codefix.createImportAdder = createImportAdder; - function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host) { + function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host, cancellationToken) { var compilerOptions = program.getCompilerOptions(); // Namespace fixes don't conflict, so just build a list. var addToNamespace = []; @@ -442430,27 +443804,26 @@ var ts; var newImports = new ts.Map(); return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes }; function addImportFromDiagnostic(diagnostic, context) { - var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider); - if (!info || !info.fixes.length) + var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider); + if (!info || !info.length) return; - addImport(info); + addImport(ts.first(info)); } function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) { var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent); var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions)); var checker = program.getTypeChecker(); var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker)); - var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider); + var exportInfo = getAllExportInfoForSymbol(sourceFile, symbol, symbolName, /*isJsxTagName*/ false, program, host, preferences, cancellationToken); var useRequire = shouldUseRequire(sourceFile, program); - var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); + var fix = getImportFixForSymbol(sourceFile, ts.Debug.checkDefined(exportInfo), moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); if (fix) { - addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined }); + addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined }); } } function addImport(info) { var _a, _b; - var fixes = info.fixes, symbolName = info.symbolName; - var fix = ts.first(fixes); + var fix = info.fix, symbolName = info.symbolName; switch (fix.kind) { case 0 /* ImportFixKind.UseNamespace */: addToNamespace.push(fix); @@ -442617,11 +443990,12 @@ var ts; AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required"; AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed"; })(AddAsTypeOnly || (AddAsTypeOnly = {})); - function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) { + function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) { var compilerOptions = program.getCompilerOptions(); var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name)) - ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] - : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true); + ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] + : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName, isJsxTagName, program, host, preferences, cancellationToken); + ts.Debug.assertIsDefined(exportInfos); var useRequire = shouldUseRequire(sourceFile, program); var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position)); var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences)); @@ -442634,7 +444008,7 @@ var ts; codefix.getImportCompletionAction = getImportCompletionAction; function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) { var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions); + var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions)); var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program); var includeSymbolNameInDescription = symbolName !== symbolToken.text; return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* QuotePreference.Double */, compilerOptions)); @@ -442649,7 +444023,16 @@ var ts; var description = _a.description, changes = _a.changes, commands = _a.commands; return { description: description, changes: changes, commands: commands }; } - function getSymbolExportInfoForSymbol(symbol, moduleSymbol, program, host) { + function getAllExportInfoForSymbol(importingFile, symbol, symbolName, preferCapitalized, program, host, preferences, cancellationToken) { + var getChecker = createGetChecker(program, host); + return ts.getExportInfoMap(importingFile, host, program, preferences, cancellationToken) + .search(importingFile.path, preferCapitalized, function (name) { return name === symbolName; }, function (info) { + if (ts.skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) { + return info; + } + }); + } + function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) { var _a, _b; var compilerOptions = program.getCompilerOptions(); var mainProgramInfo = getInfoWithChecker(program.getTypeChecker(), /*isFromPackageJson*/ false); @@ -442669,35 +444052,6 @@ var ts; } } } - function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) { - var result = []; - var compilerOptions = program.getCompilerOptions(); - var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) { - return ts.createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host); - }); - ts.forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, function (moduleSymbol, moduleFile, program, isFromPackageJson) { - var checker = program.getTypeChecker(); - // Don't import from a re-export when looking "up" like to `./index` or `../index`. - if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(importingFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) { - return; - } - var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); - if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson }); - } - for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) { - var exported = _a[_i]; - if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: exported, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: 0 /* ExportKind.Named */, targetFlags: ts.skipAlias(exported, checker).flags, isFromPackageJson: isFromPackageJson }); - } - } - }); - return result; - function isImportable(program, moduleFile, isFromPackageJson) { - var _a; - return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host)); - } - } function getImportFixes(exportInfos, useNamespaceInfo, /** undefined only for missing JSX namespace */ isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap, fromCacheOnly) { @@ -442748,11 +444102,11 @@ var ts; function getTargetModuleFromNamespaceLikeImport(declaration, checker) { var _a; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.resolveExternalModuleName(declaration.initializer.arguments[0]); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checker.getAliasedSymbol(declaration.symbol); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var namespaceImport = ts.tryCast((_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings, ts.isNamespaceImport); return namespaceImport && checker.getAliasedSymbol(namespaceImport.symbol); default: @@ -442762,11 +444116,11 @@ var ts; function getNamespaceLikeImportText(declaration) { var _a, _b, _c; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.tryCast(declaration.name, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return declaration.name.text; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return (_c = ts.tryCast((_b = declaration.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings, ts.isNamespaceImport)) === null || _c === void 0 ? void 0 : _c.name.text; default: return ts.Debug.assertNever(declaration); @@ -442793,12 +444147,12 @@ var ts; function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) { return ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags; - if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // These kinds of imports are not combinable with anything return undefined; } - if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { - return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { + return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? { kind: 2 /* ImportFixKind.AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind: importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* AddAsTypeOnly.NotAllowed */ } : undefined; } @@ -442819,7 +444173,7 @@ var ts; )) return undefined; if (importKind === 0 /* ImportKind.Named */ && - (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 268 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import + (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 271 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import ) return undefined; return { @@ -442842,7 +444196,7 @@ var ts; (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i.parent); } } - else if (i.kind === 266 /* SyntaxKind.ImportDeclaration */ || i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (i.kind === 269 /* SyntaxKind.ImportDeclaration */ || i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i); @@ -442891,11 +444245,14 @@ var ts; // 5. Literally nothing to go on return true; } + function createGetChecker(program, host) { + return ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + } function getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfo, host, preferences, fromCacheOnly) { var isJs = ts.isSourceFileJS(sourceFile); var compilerOptions = program.getCompilerOptions(); var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host); - var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + var getChecker = createGetChecker(program, host); var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions)); var getModuleSpecifiers = fromCacheOnly ? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); } @@ -442939,7 +444296,7 @@ var ts; return { kind: 3 /* ImportFixKind.AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire }; } } - function getFixesInfo(context, errorCode, pos, useAutoImportProvider) { + function getFixInfos(context, errorCode, pos, useAutoImportProvider) { var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos); var info; if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -442949,19 +444306,23 @@ var ts; return undefined; } else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) { - var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()); + var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions())); var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program); - return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text }; + return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }]; } else { info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); } var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); - return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter, context.host) }); + return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host); } - function sortFixes(fixes, sourceFile, program, packageJsonImportFilter, host) { + function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) { var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); }; - return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); }); + return ts.sort(fixes, function (a, b) { + return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || + ts.compareValues(a.fix.kind, b.fix.kind) || + compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); + }); } function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) { if (!ts.some(fixes)) @@ -443012,7 +444373,6 @@ var ts; return 0 /* Comparison.EqualTo */; } function getFixesInfoForUMDImport(_a, token) { - var _b; var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var umdSymbol = getUmdSymbol(token, checker); @@ -443024,7 +444384,7 @@ var ts; var useRequire = shouldUseRequire(sourceFile, program); var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined; var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes; - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text }; + return fixes.map(function (fix) { var _a; return ({ fix: fix, symbolName: symbolName, errorIdentifierText: (_a = ts.tryCast(token, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text }); }); } function getUmdSymbol(token, checker) { // try the identifier to see if it is the umd symbol @@ -443085,19 +444445,20 @@ var ts; var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions); - // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. - if (symbolName === "default" /* InternalSymbolName.Default */) { - return undefined; - } - var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); - var useRequire = shouldUseRequire(sourceFile, program); - var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); - var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { - var _ = _a[0], exportInfos = _a[1]; - return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; - })); - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text }; + return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) { + // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. + if (symbolName === "default" /* InternalSymbolName.Default */) { + return undefined; + } + var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); + var useRequire = shouldUseRequire(sourceFile, program); + var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); + var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { + var _ = _a[0], exportInfos = _a[1]; + return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; + })); + return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); }); + }); } function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) { var checker = program.getTypeChecker(); @@ -443109,15 +444470,16 @@ var ts; return undefined; return { kind: 4 /* ImportFixKind.PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration }; } - function getSymbolName(sourceFile, checker, symbolToken, compilerOptions) { + function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) { var parent = symbolToken.parent; if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) { var jsxNamespace = checker.getJsxNamespace(sourceFile); if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) { - return jsxNamespace; + var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* SymbolFlags.Value */, /*excludeGlobals*/ false); + return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace]; } } - return symbolToken.text; + return [symbolToken.text]; } function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) { if (ts.isIntrinsicJsxName(symbolToken.text)) @@ -443226,7 +444588,7 @@ var ts; case 4 /* ImportFixKind.PromoteTypeOnly */: { var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration; var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile); - return promotedDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ + return promotedDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; } @@ -443236,7 +444598,7 @@ var ts; } function getModuleSpecifierText(promotedDeclaration) { var _a, _b; - return promotedDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ + return promotedDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? ((_b = ts.tryCast((_a = ts.tryCast(promotedDeclaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text; } @@ -443244,7 +444606,7 @@ var ts; // See comment in `doAddExistingFix` on constant with the same name. var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules; switch (aliasDeclaration.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: if (aliasDeclaration.isTypeOnly) { if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) { changes.delete(sourceFile, aliasDeclaration); @@ -443262,13 +444624,13 @@ var ts; promoteImportClause(aliasDeclaration.parent.parent); return aliasDeclaration.parent.parent; } - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: promoteImportClause(aliasDeclaration); return aliasDeclaration; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: promoteImportClause(aliasDeclaration.parent); return aliasDeclaration.parent; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1)); return aliasDeclaration; default: @@ -443280,7 +444642,7 @@ var ts; var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports); if (namedImports && namedImports.elements.length > 1) { if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) && - aliasDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && + aliasDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { // The import specifier being promoted will be the only non-type-only, // import in the NamedImports, so it should be moved to the front. @@ -443290,7 +444652,7 @@ var ts; for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) { var element = _a[_i]; if (element !== aliasDeclaration && !element.isTypeOnly) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, element); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, element); } } } @@ -443299,7 +444661,7 @@ var ts; } function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) { var _a; - if (clause.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (clause.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (defaultImport) { addElementToBindingPattern(clause, defaultImport.name, "default"); } @@ -443360,7 +444722,7 @@ var ts; if (convertExistingToTypeOnly && existingSpecifiers) { for (var _d = 0, existingSpecifiers_1 = existingSpecifiers; _d < existingSpecifiers_1.length; _d++) { var specifier = existingSpecifiers_1[_d]; - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, specifier); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, specifier); } } } @@ -443535,7 +444897,7 @@ var ts; var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; }); if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) return; - var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); if (declaration === undefined) return; if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) { @@ -443569,14 +444931,6 @@ var ts; } } } - function findAncestorMatchingSpan(sourceFile, span) { - var end = ts.textSpanEnd(span); - var token = ts.getTokenAtPosition(sourceFile, span.start); - while (token.end < end) { - token = token.parent; - } - return token; - } function tryGetConstraintFromDiagnosticMessage(messageText) { var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1]; return constraint; @@ -443720,7 +445074,7 @@ var ts; accessibilityModifier ? accessibilityModifier.end : lastDecorator ? ts.skipTrivia(sourceFile.text, lastDecorator.end) : classElement.getStart(sourceFile); var options = accessibilityModifier || staticModifier || abstractModifier ? { prefix: " " } : { suffix: " " }; - changeTracker.insertModifierAt(sourceFile, modifierPos, 159 /* SyntaxKind.OverrideKeyword */, options); + changeTracker.insertModifierAt(sourceFile, modifierPos, 161 /* SyntaxKind.OverrideKeyword */, options); } function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) { var classElement = findContainerClassElementLike(sourceFile, pos); @@ -443734,13 +445088,13 @@ var ts; } function isClassElementLikeHasJSDoc(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.isParameterPropertyDeclaration(node, node.parent); default: return false; @@ -443852,6 +445206,143 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixImportNonExportedMember"; + var errorCodes = [ + ts.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + fixIds: [fixId], + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) + return undefined; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, program, info); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId, ts.Diagnostics.Export_all_referenced_locals)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + var exports = new ts.Map(); + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info === undefined) + return undefined; + var exportName = info.exportName, node = info.node, moduleSourceFile = info.moduleSourceFile; + if (tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly) === undefined && ts.canHaveExportModifier(node)) { + changes.insertExportModifier(moduleSourceFile, node); + } + else { + var moduleExports = exports.get(moduleSourceFile) || { typeOnlyExports: [], exports: [] }; + if (exportName.isTypeOnly) { + moduleExports.typeOnlyExports.push(exportName); + } + else { + moduleExports.exports.push(exportName); + } + exports.set(moduleSourceFile, moduleExports); + } + }); + exports.forEach(function (moduleExports, moduleSourceFile) { + var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ true); + if (exportDeclaration && exportDeclaration.isTypeOnly) { + doChanges(changes, program, moduleSourceFile, moduleExports.typeOnlyExports, exportDeclaration); + doChanges(changes, program, moduleSourceFile, moduleExports.exports, tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ false)); + } + else { + doChanges(changes, program, moduleSourceFile, __spreadArray(__spreadArray([], moduleExports.exports, true), moduleExports.typeOnlyExports, true), exportDeclaration); + } + }); + })); + } + }); + function getInfo(sourceFile, pos, program) { + var _a; + var token = ts.getTokenAtPosition(sourceFile, pos); + if (ts.isIdentifier(token)) { + var importDeclaration = ts.findAncestor(token, ts.isImportDeclaration); + if (importDeclaration === undefined) + return undefined; + var moduleSpecifier = ts.isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : undefined; + if (moduleSpecifier === undefined) + return undefined; + var resolvedModule = ts.getResolvedModule(sourceFile, moduleSpecifier, /*mode*/ undefined); + if (resolvedModule === undefined) + return undefined; + var moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName); + if (moduleSourceFile === undefined || ts.isSourceFileFromLibrary(program, moduleSourceFile)) + return undefined; + var moduleSymbol = moduleSourceFile.symbol; + var locals = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals; + if (locals === undefined) + return undefined; + var localSymbol = locals.get(token.escapedText); + if (localSymbol === undefined) + return undefined; + var node = getNodeOfSymbol(localSymbol); + if (node === undefined) + return undefined; + var exportName = { node: token, isTypeOnly: ts.isTypeDeclaration(node) }; + return { exportName: exportName, node: node, moduleSourceFile: moduleSourceFile, moduleSpecifier: moduleSpecifier }; + } + return undefined; + } + function doChange(changes, program, _a) { + var exportName = _a.exportName, node = _a.node, moduleSourceFile = _a.moduleSourceFile; + var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly); + if (exportDeclaration) { + updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]); + } + else if (ts.canHaveExportModifier(node)) { + changes.insertExportModifier(moduleSourceFile, node); + } + else { + createExport(changes, program, moduleSourceFile, [exportName]); + } + } + function doChanges(changes, program, sourceFile, moduleExports, node) { + if (ts.length(moduleExports)) { + if (node) { + updateExport(changes, program, sourceFile, node, moduleExports); + } + else { + createExport(changes, program, sourceFile, moduleExports); + } + } + } + function tryGetExportDeclaration(sourceFile, isTypeOnly) { + var predicate = function (node) { + return ts.isExportDeclaration(node) && (isTypeOnly && node.isTypeOnly || !node.isTypeOnly); + }; + return ts.findLast(sourceFile.statements, predicate); + } + function updateExport(changes, program, sourceFile, node, names) { + var namedExports = node.exportClause && ts.isNamedExports(node.exportClause) ? node.exportClause.elements : ts.factory.createNodeArray([]); + var allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions().isolatedModules || ts.find(namedExports, function (e) { return e.isTypeOnly; })); + changes.replaceNode(sourceFile, node, ts.factory.updateExportDeclaration(node, node.modifiers, node.isTypeOnly, ts.factory.createNamedExports(ts.factory.createNodeArray(__spreadArray(__spreadArray([], namedExports, true), createExportSpecifiers(names, allowTypeModifier), true), /*hasTrailingComma*/ namedExports.hasTrailingComma)), node.moduleSpecifier, node.assertClause)); + } + function createExport(changes, program, sourceFile, names) { + changes.insertNodeAtEndOfScope(sourceFile, sourceFile, ts.factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamedExports(createExportSpecifiers(names, /*allowTypeModifier*/ !!program.getCompilerOptions().isolatedModules)), /*moduleSpecifier*/ undefined, /*assertClause*/ undefined)); + } + function createExportSpecifiers(names, allowTypeModifier) { + return ts.factory.createNodeArray(ts.map(names, function (n) { return ts.factory.createExportSpecifier(allowTypeModifier && n.isTypeOnly, /*propertyName*/ undefined, n.node); })); + } + function getNodeOfSymbol(symbol) { + if (symbol.valueDeclaration === undefined) { + return ts.firstOrUndefined(symbol.declarations); + } + var declaration = symbol.valueDeclaration; + var variableStatement = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : undefined; + return variableStatement && ts.length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -443872,7 +445363,7 @@ var ts; }); function getNamedTupleMember(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); - return ts.findAncestor(token, function (t) { return t.kind === 197 /* SyntaxKind.NamedTupleMember */; }); + return ts.findAncestor(token, function (t) { return t.kind === 199 /* SyntaxKind.NamedTupleMember */; }); } function doChange(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { @@ -443881,11 +445372,11 @@ var ts; var unwrappedType = namedTupleMember.type; var sawOptional = false; var sawRest = false; - while (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 186 /* SyntaxKind.RestType */ || unwrappedType.kind === 191 /* SyntaxKind.ParenthesizedType */) { - if (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */) { + while (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 188 /* SyntaxKind.RestType */ || unwrappedType.kind === 193 /* SyntaxKind.ParenthesizedType */) { + if (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */) { sawOptional = true; } - else if (unwrappedType.kind === 186 /* SyntaxKind.RestType */) { + else if (unwrappedType.kind === 188 /* SyntaxKind.RestType */) { sawRest = true; } unwrappedType = unwrappedType.type; @@ -444156,7 +445647,7 @@ var ts; if (isFunctionType) { var sig = checker.getSignatureFromDeclaration(declaration); if (sig) { - if (ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Async */)) { + if (ts.hasSyntacticModifier(declaration, 512 /* ModifierFlags.Async */)) { exprType = checker.createPromiseType(exprType); } var newSig = checker.createSignature(declaration, sig.typeParameters, sig.thisParameter, sig.parameters, exprType, @@ -444200,19 +445691,19 @@ var ts; } function getVariableLikeInitializer(declaration) { switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: return declaration.initializer; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return declaration.initializer && (ts.isJsxExpression(declaration.initializer) ? declaration.initializer.expression : undefined); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return undefined; } } @@ -444266,6 +445757,15 @@ var ts; ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, ts.Diagnostics.Cannot_find_name_0.code ]; + var InfoKind; + (function (InfoKind) { + InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; + InfoKind[InfoKind["Enum"] = 1] = "Enum"; + InfoKind[InfoKind["Function"] = 2] = "Function"; + InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; + InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; + InfoKind[InfoKind["Signature"] = 5] = "Signature"; + })(InfoKind || (InfoKind = {})); codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { @@ -444274,19 +445774,19 @@ var ts; if (!info) { return undefined; } - if (info.kind === 3 /* InfoKind.ObjectLiteral */) { + if (info.kind === InfoKind.ObjectLiteral) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); }); return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)]; } - if (info.kind === 4 /* InfoKind.JsxAttributes */) { + if (info.kind === InfoKind.JsxAttributes) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); }); return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)]; } - if (info.kind === 2 /* InfoKind.Function */) { + if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); }); return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)]; } - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); }); return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)]; } @@ -444304,20 +445804,20 @@ var ts; if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) { return; } - if (fixId === fixMissingFunctionDeclaration && info.kind === 2 /* InfoKind.Function */) { + if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) { addFunctionDeclaration(changes, context, info); } - else if (fixId === fixMissingProperties && info.kind === 3 /* InfoKind.ObjectLiteral */) { + else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) { addObjectLiteralProperties(changes, context, info); } - else if (fixId === fixMissingAttributes && info.kind === 4 /* InfoKind.JsxAttributes */) { + else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) { addJsxAttributes(changes, context, info); } else { - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { addEnumMemberDeclaration(changes, checker, info); } - if (info.kind === 0 /* InfoKind.TypeLikeDeclaration */) { + if (info.kind === InfoKind.TypeLikeDeclaration) { var parentDeclaration = info.parentDeclaration, token_1 = info.token; var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; }); if (!infos.some(function (i) { return i.token.text === token_1.text; })) { @@ -444361,14 +445861,6 @@ var ts; })); }, }); - var InfoKind; - (function (InfoKind) { - InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; - InfoKind[InfoKind["Enum"] = 1] = "Enum"; - InfoKind[InfoKind["Function"] = 2] = "Function"; - InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; - InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; - })(InfoKind || (InfoKind = {})); function getInfo(sourceFile, tokenPos, errorCode, checker, program) { // The identifier of the missing property. eg: // this.missing = 1; @@ -444381,7 +445873,7 @@ var ts; var argIndex = ts.findIndex(parent.parent.arguments, function (arg) { return arg === parent; }); if (argIndex < 0) return undefined; - var signature = ts.singleOrUndefined(checker.getSignaturesOfType(checker.getTypeAtLocation(parent.parent.expression), 0 /* SignatureKind.Call */)); + var signature = checker.getResolvedSignature(parent.parent); if (!(signature && signature.declaration && signature.parameters[argIndex])) return undefined; var param = signature.parameters[argIndex].valueDeclaration; @@ -444390,7 +445882,7 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: param.name, properties: properties, parentDeclaration: parent }; + return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent }; } if (!ts.isMemberName(token)) return undefined; @@ -444398,17 +445890,26 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: token, properties: properties, parentDeclaration: parent.initializer }; + return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer }; } if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) { var target = ts.getEmitScriptTarget(program.getCompilerOptions()); var attributes = getUnmatchedAttributes(checker, target, token.parent); if (!ts.length(attributes)) return undefined; - return { kind: 4 /* InfoKind.JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent }; + return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent }; } - if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: sourceFile }; + if (ts.isIdentifier(token)) { + var type = checker.getContextualType(token); + if (type && ts.getObjectFlags(type) & 16 /* ObjectFlags.Anonymous */) { + var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */)); + if (signature === undefined) + return undefined; + return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) }; + } + if (ts.isCallExpression(parent) && parent.expression === token) { + return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: findScope(token) }; + } } if (!ts.isPropertyAccessExpression(parent)) return undefined; @@ -444419,14 +445920,14 @@ var ts; if (ts.isIdentifier(token) && ts.isCallExpression(parent.parent)) { var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration); var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile(); - if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; + if (moduleDeclaration && moduleDeclarationSourceFile && !ts.isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; } var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile); if (sourceFile.commonJsModuleIndicator) return undefined; - if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; + if (moduleSourceFile && !ts.isSourceFileFromLibrary(program, moduleSourceFile)) { + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; } } var classDeclaration = ts.find(symbol.declarations, ts.isClassLike); @@ -444435,7 +445936,7 @@ var ts; return undefined; // Prefer to change the class instead of the interface if they are merged var declaration = classDeclaration || ts.find(symbol.declarations, function (d) { return ts.isInterfaceDeclaration(d) || ts.isTypeLiteralNode(d); }); - if (declaration && !isSourceFileFromLibrary(program, declaration.getSourceFile())) { + if (declaration && !ts.isSourceFileFromLibrary(program, declaration.getSourceFile())) { var makeStatic = !ts.isTypeLiteralNode(declaration) && (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol); if (makeStatic && (ts.isPrivateIdentifier(token) || ts.isInterfaceDeclaration(declaration))) return undefined; @@ -444444,17 +445945,14 @@ var ts; (makeStatic ? 32 /* ModifierFlags.Static */ : 0 /* ModifierFlags.None */) | (ts.startsWithUnderscore(token.text) ? 8 /* ModifierFlags.Private */ : 0 /* ModifierFlags.None */); var isJSFile = ts.isSourceFileJS(declSourceFile); var call = ts.tryCast(parent.parent, ts.isCallExpression); - return { kind: 0 /* InfoKind.TypeLikeDeclaration */, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; + return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; } var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration); - if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { - return { kind: 1 /* InfoKind.Enum */, token: token, parentDeclaration: enumDeclaration }; + if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !ts.isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { + return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; } - function isSourceFileFromLibrary(program, node) { - return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node); - } function getActionsForMissingMemberDeclaration(context, info) { return info.isJSFile ? ts.singleElementArray(createActionForAddMissingMemberInJavascriptFile(context, info)) : createActionsForAddMissingMemberInTypeScriptFile(context, info); @@ -444475,7 +445973,7 @@ var ts; function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { var tokenName = token.text; if (makeStatic) { - if (classDeclaration.kind === 226 /* SyntaxKind.ClassExpression */) { + if (classDeclaration.kind === 228 /* SyntaxKind.ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -444526,7 +446024,7 @@ var ts; } function getTypeNode(checker, node, token) { var typeNode; - if (token.parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (token.parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var binaryExpression = token.parent.parent; var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -444536,7 +446034,7 @@ var ts; var contextualType = checker.getContextualType(token.parent); typeNode = contextualType ? checker.typeToTypeNode(contextualType, /*enclosingDeclaration*/ undefined, 1 /* NodeBuilderFlags.NoTruncation */) : undefined; } - return typeNode || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return typeNode || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) { var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; @@ -444564,7 +446062,7 @@ var ts; } function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) { // Index signatures cannot have the static modifier. - var stringTypeNode = ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + var stringTypeNode = ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); var indexingParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "x", @@ -444595,7 +446093,7 @@ var ts; } function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { var importAdder = codefix.createImportAdder(sourceFile, context.program, context.preferences, context.host); - var kind = ts.isClassLike(parentDeclaration) ? 169 /* SyntaxKind.MethodDeclaration */ : 168 /* SyntaxKind.MethodSignature */; + var kind = ts.isClassLike(parentDeclaration) ? 171 /* SyntaxKind.MethodDeclaration */ : 170 /* SyntaxKind.MethodSignature */; var signatureDeclaration = codefix.createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); var containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); if (containingMethodDeclaration) { @@ -444624,9 +446122,17 @@ var ts; }); } function addFunctionDeclaration(changes, context, info) { + var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences); var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(256 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration); - changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); + var functionDeclaration = info.kind === InfoKind.Function + ? codefix.createSignatureDeclarationFromCallExpression(259 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration) + : codefix.createSignatureDeclarationFromSignature(259 /* SyntaxKind.FunctionDeclaration */, context, quotePreference, info.signature, codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), info.token, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder); + if (functionDeclaration === undefined) { + ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error."); + } + ts.isReturnStatement(info.parentDeclaration) + ? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true) + : changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); importAdder.writeFixes(changes); } function addJsxAttributes(changes, context, info) { @@ -444722,7 +446228,7 @@ var ts; var signature = checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */); if (signature === undefined) return createUndefined(); - var func = codefix.createSignatureDeclarationFromSignature(213 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); + var func = codefix.createSignatureDeclarationFromSignature(215 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); return func !== null && func !== void 0 ? func : createUndefined(); } if (ts.getObjectFlags(type) & 1 /* ObjectFlags.Class */) { @@ -444776,14 +446282,21 @@ var ts; return declaration && declaration.parent === node ? declaration : undefined; } function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) { - if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* TypeFlags.UniqueESSymbol */) { - var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* SymbolFlags.Value */, symbol.valueDeclaration, 1048576 /* NodeBuilderFlags.AllowUniqueESSymbolType */); - if (expression) { - return ts.factory.createComputedPropertyName(expression); - } + if (ts.isTransientSymbol(symbol)) { + var prop = checker.symbolToNode(symbol, 111551 /* SymbolFlags.Value */, /*enclosingDeclaration*/ undefined, 1073741824 /* NodeBuilderFlags.WriteComputedProps */); + if (prop && ts.isComputedPropertyName(prop)) + return prop; } return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* QuotePreference.Single */); } + function findScope(node) { + if (ts.findAncestor(node, ts.isJsxExpression)) { + var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement); + if (returnStatement) + return returnStatement; + } + return ts.getSourceFileOfNode(node); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -444934,7 +446447,7 @@ var ts; // See `codeFixClassExtendAbstractProtectedProperty.ts` in https://github.com/Microsoft/TypeScript/pull/11547/files // (now named `codeFixClassExtendAbstractPrivateProperty.ts`) var flags = ts.getSyntacticModifierFlags(ts.first(symbol.getDeclarations())); - return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 128 /* ModifierFlags.Abstract */); + return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 256 /* ModifierFlags.Abstract */); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -445097,6 +446610,63 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixNaNEquality"; + var errorCodes = [ + ts.Diagnostics.This_condition_will_always_return_0.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(program, sourceFile, span); + if (info === undefined) + return; + var suggestion = info.suggestion, expression = info.expression, arg = info.arg; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)]; + }, + fixIds: [fixId], + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length)); + if (info) { + doChange(changes, diag.file, info.arg, info.expression); + } + }); + } + }); + function getInfo(program, sourceFile, span) { + var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; }); + if (diag === undefined || diag.relatedInformation === undefined) + return; + var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; }); + if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) + return; + var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + if (token === undefined) + return; + if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) { + return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token }; + } + return undefined; + } + function doChange(changes, sourceFile, arg, expression) { + var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]); + var operator = expression.operatorToken.kind; + changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ + ? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression); + } + function getSuggestion(messageText) { + var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1]; + return suggestion; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -445414,7 +446984,7 @@ var ts; var importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); if (!importDeclaration) return; - var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); + var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); var typeOnlyChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program); }); var actions; if (namespaceChanges.length) { @@ -445429,7 +446999,7 @@ var ts; }); function getImportDeclaration(sourceFile, program, start) { var identifier = ts.tryCast(ts.getTokenAtPosition(sourceFile, start), ts.isIdentifier); - if (!identifier || identifier.parent.kind !== 178 /* SyntaxKind.TypeReference */) + if (!identifier || identifier.parent.kind !== 180 /* SyntaxKind.TypeReference */) return; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(identifier); @@ -445441,11 +447011,11 @@ var ts; // new type-only import declaration, but honestly I doubt anyone will ever use this // codefix at all, so it's probably not worth the lines of code. function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) { - if (importDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importDeclaration.name); + if (importDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importDeclaration.name); return; } - var importClause = importDeclaration.kind === 267 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; + var importClause = importDeclaration.kind === 270 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; if (importClause.name && importClause.namedBindings) { // Cannot convert an import with a default import and named bindings to type-only // (it's a grammar error). @@ -445462,7 +447032,7 @@ var ts; // Don't convert it to type-only. return; } - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importClause); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importClause); } function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) { ts.refactor.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent); @@ -445540,7 +447110,7 @@ var ts; ]; } var result = []; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); }); var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text; result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown)); @@ -445582,7 +447152,7 @@ var ts; break; } case fixIdDelete: { - if (token.kind === 137 /* SyntaxKind.InferKeyword */ || isImport(token)) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */ || isImport(token)) { break; // Can't delete } else if (ts.isJSDocTemplateTag(token)) { @@ -445611,7 +447181,7 @@ var ts; break; } case fixIdInfer: - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { changeInferToUnknown(changes, sourceFile, token); } break; @@ -445622,7 +447192,7 @@ var ts; }, }); function changeInferToUnknown(changes, sourceFile, token) { - changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)); + changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)); } function createDeleteFix(changes, diag) { return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations); @@ -445632,7 +447202,7 @@ var ts; } function isImport(token) { return token.kind === 100 /* SyntaxKind.ImportKeyword */ - || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 270 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 267 /* SyntaxKind.ImportClause */); + || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 273 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 270 /* SyntaxKind.ImportClause */); } /** Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing. */ function tryGetFullImport(token) { @@ -445642,7 +447212,7 @@ var ts; return ts.isVariableDeclarationList(token.parent) && ts.first(token.parent.getChildren(sourceFile)) === token; } function deleteEntireVariableStatement(changes, sourceFile, node) { - changes.delete(sourceFile, node.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? node.parent : node); + changes.delete(sourceFile, node.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? node.parent : node); } function deleteDestructuringElements(changes, sourceFile, node) { ts.forEach(node.elements, function (n) { return changes.delete(sourceFile, n); }); @@ -445651,7 +447221,7 @@ var ts; // Don't offer to prefix a property. if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code) return; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name; } if (ts.isIdentifier(token) && canPrefix(token)) { @@ -445667,14 +447237,14 @@ var ts; } function canPrefix(token) { switch (token.parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return true; } } @@ -445729,8 +447299,8 @@ var ts; function mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll) { var parent = parameter.parent; switch (parent.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: var index = parent.parameters.indexOf(parameter); var referent = ts.isMethodDeclaration(parent) ? parent.name : parent; var entries = ts.FindAllReferences.Core.getReferencedSymbolsForNode(parent.pos, referent, program, sourceFiles, cancellationToken); @@ -445760,20 +447330,20 @@ var ts; } } return true; - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { if (parent.name && isCallbackLike(checker, sourceFile, parent.name)) { return isLastParameter(parent, parameter, isFixAll); } return true; } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: // Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused. return isLastParameter(parent, parameter, isFixAll); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Setter must have a parameter return false; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Getter cannot have parameters return true; default: @@ -445834,7 +447404,7 @@ var ts; var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent; if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) { switch (container.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (container.elseStatement) { if (ts.isBlock(statement.parent)) { break; @@ -445845,8 +447415,8 @@ var ts; return; } // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: changes.delete(sourceFile, container); return; } @@ -445919,7 +447489,7 @@ var ts; var typeNode = info.typeNode, type = info.type; var original = typeNode.getText(sourceFile); var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; - if (typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */) { + if (typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` actions.push(fix(checker.getNullableType(type, 32768 /* TypeFlags.Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -445939,7 +447509,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; + var fixedType = typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -445956,22 +447526,22 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 229 /* SyntaxKind.AsExpression */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 176 /* SyntaxKind.IndexSignature */: - case 195 /* SyntaxKind.MappedType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 231 /* SyntaxKind.AsExpression */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 178 /* SyntaxKind.IndexSignature */: + case 197 /* SyntaxKind.MappedType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; default: return false; @@ -446074,14 +447644,14 @@ var ts; } var insertBefore; switch (containingFunction.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: insertBefore = containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: insertBefore = ts.findChildOfKind(containingFunction, 98 /* SyntaxKind.FunctionKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: var kind = containingFunction.typeParameters ? 29 /* SyntaxKind.LessThanToken */ : 20 /* SyntaxKind.OpenParenToken */; insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters); break; @@ -446101,7 +447671,7 @@ var ts; changes.replaceNode(sourceFile, returnType, ts.factory.createTypeReferenceNode("Promise", ts.factory.createNodeArray([returnType]))); } } - changes.insertModifierBefore(sourceFile, 131 /* SyntaxKind.AsyncKeyword */, insertBefore); + changes.insertModifierBefore(sourceFile, 132 /* SyntaxKind.AsyncKeyword */, insertBefore); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -446417,7 +447987,7 @@ var ts; function annotate(changes, importAdder, sourceFile, declaration, type, program, host) { var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { - if (ts.isInJSFile(sourceFile) && declaration.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (ts.isInJSFile(sourceFile) && declaration.kind !== 168 /* SyntaxKind.PropertySignature */) { var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration; if (!parent) { return; @@ -446504,19 +448074,19 @@ var ts; function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { var searchToken; switch (containingFunction.kind) { - case 171 /* SyntaxKind.Constructor */: - searchToken = ts.findChildOfKind(containingFunction, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); + case 173 /* SyntaxKind.Constructor */: + searchToken = ts.findChildOfKind(containingFunction, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: var parent = containingFunction.parent; searchToken = (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent)) && ts.isIdentifier(parent.name) ? parent.name : containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: searchToken = containingFunction.name; break; } @@ -446658,24 +448228,24 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: inferTypeFromExpressionStatement(node, usage); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: usage.isNumber = true; break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpression(node.parent, usage); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: inferTypeFromBinaryExpression(node, node.parent, usage); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: inferTypeFromSwitchStatementLabel(node.parent, usage); break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpression(node.parent, usage); } @@ -446683,20 +448253,20 @@ var ts; inferTypeFromContextualType(node, usage); } break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: inferTypeFromPropertyAccessExpression(node.parent, usage); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: inferTypeFromPropertyElementExpression(node.parent, node, usage); break; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: inferTypeFromPropertyAssignment(node.parent, usage); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: inferTypeFromPropertyDeclaration(node.parent, usage); break; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var _a = node.parent, name = _a.name, initializer = _a.initializer; if (node === name) { if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error. @@ -446818,7 +448388,7 @@ var ts; case 56 /* SyntaxKind.BarBarToken */: case 60 /* SyntaxKind.QuestionQuestionToken */: if (node === parent.left && - (node.parent.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usage, checker.getTypeAtLocation(parent.right)); @@ -446846,7 +448416,7 @@ var ts; } } calculateUsageOfNode(parent, call.return_); - if (parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */) { (usage.calls || (usage.calls = [])).push(call); } else { @@ -447300,25 +448870,44 @@ var ts; * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub. */ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) { + var _a; if (preserveOptional === void 0) { preserveOptional = 3 /* PreserveOptionalFlags.All */; } if (isAmbient === void 0) { isAmbient = false; } var declarations = symbol.getDeclarations(); - if (!(declarations && declarations.length)) { - return undefined; - } + var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0]; var checker = context.program.getTypeChecker(); var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions()); - var declaration = declarations[0]; - var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); - var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration)); - var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined; + /** + * (#49811) + * Note that there are cases in which the symbol declaration is not present. For example, in the code below both + * `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type + * parent): + * + * ```ts + * type Base = { ax: number; ay: string }; + * type BaseKeys = keyof Base; + * type MappedIndirect = { [K in BaseKeys]: boolean }; + * ``` + * + * In such cases, we assume the declaration to be a `PropertySignature`. + */ + var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 168 /* SyntaxKind.PropertySignature */; + var declarationName = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); + var effectiveModifierFlags = declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* ModifierFlags.None */; + var modifierFlags = effectiveModifierFlags & 4 /* ModifierFlags.Public */ ? 4 /* ModifierFlags.Public */ : + effectiveModifierFlags & 16 /* ModifierFlags.Protected */ ? 16 /* ModifierFlags.Protected */ : + 0 /* ModifierFlags.None */; + if (declaration && ts.isAutoAccessorPropertyDeclaration(declaration)) { + modifierFlags |= 128 /* ModifierFlags.Accessor */; + } + var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); var optional = !!(symbol.flags & 16777216 /* SymbolFlags.Optional */); var ambient = !!(enclosingDeclaration.flags & 16777216 /* NodeFlags.Ambient */) || isAmbient; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: + switch (kind) { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: var flags = quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : undefined; var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); if (importAdder) { @@ -447328,11 +448917,12 @@ var ts; importSymbols(importAdder, importableReference.symbols); } } - addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, + addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? createName(declarationName) : symbol.getName(), optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, /*initializer*/ undefined)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + ts.Debug.assertIsDefined(declarations); var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context)); var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration); var orderedAccessors = allAccessors.secondAccessor @@ -447348,19 +448938,19 @@ var ts; for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) { var accessor = orderedAccessors_1[_i]; if (ts.isGetAccessorDeclaration(accessor)) { - addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, createName(declarationName), ts.emptyArray, createTypeNode(typeNode_1), createBody(body, quotePreference, ambient))); } else { ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter"); var parameter = ts.getSetAccessorValueParameter(accessor); var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined; - addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, createName(declarationName), createDummyParameters(1, [parameterName], [createTypeNode(typeNode_1)], 1, /*inJs*/ false), createBody(body, quotePreference, ambient))); } } break; } - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: // The signature for the implementation appears as an entry in `signatures` iff // there is only one signature. // If there are overloads and an implementation signature, it appears as an @@ -447368,6 +448958,7 @@ var ts; // If there is more than one overload but no implementation signature // (eg: an abstract method or interface declaration), there is a 1-1 // correspondence of declarations and signatures. + ts.Debug.assertIsDefined(declarations); var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures(); if (!ts.some(signatures)) { break; @@ -447375,31 +448966,41 @@ var ts; if (declarations.length === 1) { ts.Debug.assert(signatures.length === 1, "One declaration implies one signature"); var signature = signatures[0]; - outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference, ambient)); break; } - for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) { - var signature = signatures_1[_a]; + for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) { + var signature = signatures_1[_b]; // Ensure nodes are fresh so they can have different positions when going through formatting. - outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName)); } if (!ambient) { if (declarations.length > signatures.length) { var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); - outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference)); } else { ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); - addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); + addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); } } break; } function outputMethod(quotePreference, signature, modifiers, name, body) { - var method = createSignatureDeclarationFromSignature(169 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); + var method = createSignatureDeclarationFromSignature(171 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); if (method) addClassElement(method); } + function createName(node) { + return ts.getSynthesizedDeepClone(node, /*includeTrivia*/ false); + } + function createBody(block, quotePreference, ambient) { + return ambient ? undefined : + ts.getSynthesizedDeepClone(block, /*includeTrivia*/ false) || createStubbedMethodBody(quotePreference); + } + function createTypeNode(typeNode) { + return ts.getSynthesizedDeepClone(typeNode, /*includeTrivia*/ false); + } } codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol; function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) { @@ -447473,6 +449074,9 @@ var ts; if (ts.isMethodDeclaration(signatureDeclaration)) { return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); } + if (ts.isFunctionDeclaration(signatureDeclaration)) { + return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body); + } return undefined; } codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature; @@ -447501,13 +449105,13 @@ var ts; ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker); switch (kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createMethodDeclaration(modifiers, asteriskToken, name, /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference)); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return ts.factory.createMethodSignature(modifiers, name, - /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */) : type); - case 256 /* SyntaxKind.FunctionDeclaration */: + /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */) : type); + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference)); default: ts.Debug.fail("Unexpected kind"); @@ -447644,7 +449248,7 @@ var ts; /*dotDotDotToken*/ undefined, /*name*/ parameterName + (parameterNameCount || ""), /*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, - /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), + /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), /*initializer*/ undefined); parameters.push(newParameter); } @@ -447674,7 +449278,7 @@ var ts; if (someSigHasRestParameter) { var restParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", - /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)), + /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)), /*initializer*/ undefined); parameters.push(restParameter); } @@ -447702,15 +449306,6 @@ var ts; /*multiline*/ true); } codefix.createStubbedBody = createStubbedBody; - function createVisibilityModifier(flags) { - if (flags & 4 /* ModifierFlags.Public */) { - return ts.factory.createToken(123 /* SyntaxKind.PublicKeyword */); - } - else if (flags & 16 /* ModifierFlags.Protected */) { - return ts.factory.createToken(122 /* SyntaxKind.ProtectedKeyword */); - } - return undefined; - } function setJsonCompilerOptionValues(changeTracker, configFile, options) { var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile); if (!tsconfigObjectLiteral) @@ -447789,6 +449384,15 @@ var ts; symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); }); } codefix.importSymbols = importSymbols; + function findAncestorMatchingSpan(sourceFile, span) { + var end = ts.textSpanEnd(span); + var token = ts.getTokenAtPosition(sourceFile, span.start); + while (token.end < end) { + token = token.parent; + } + return token; + } + codefix.findAncestorMatchingSpan = findAncestorMatchingSpan; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -447811,13 +449415,13 @@ var ts; if (ts.isClassLike(container)) { var modifierFlags = ts.getEffectiveModifierFlags(declaration); if (ts.isSourceFileJS(file)) { - var modifiers = ts.createModifiers(modifierFlags); + var modifiers = ts.factory.createModifiersFromModifierFlags(modifierFlags); accessorModifiers = modifiers; fieldModifiers = modifiers; } else { - accessorModifiers = ts.createModifiers(prepareModifierFlagsForAccessor(modifierFlags)); - fieldModifiers = ts.createModifiers(prepareModifierFlagsForField(modifierFlags)); + accessorModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForAccessor(modifierFlags)); + fieldModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForField(modifierFlags)); } if (ts.canHaveDecorators(declaration)) { fieldModifiers = ts.concatenate(ts.getDecorators(declaration), fieldModifiers); @@ -447886,7 +449490,7 @@ var ts; error: ts.getLocaleSpecificMessage(ts.Diagnostics.Name_is_not_valid) }; } - if (((ts.getEffectiveModifierFlags(declaration) & 125951 /* ModifierFlags.Modifier */) | meaning) !== meaning) { + if (((ts.getEffectiveModifierFlags(declaration) & 126975 /* ModifierFlags.Modifier */) | meaning) !== meaning) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_property_with_modifier) }; @@ -447899,7 +449503,7 @@ var ts; isStatic: ts.hasStaticModifier(declaration), isReadonly: ts.hasEffectiveReadonlyModifier(declaration), type: getDeclarationType(declaration, program), - container: declaration.kind === 164 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, + container: declaration.kind === 166 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, originalName: declaration.name.text, declaration: declaration, fieldName: fieldName, @@ -447973,7 +449577,7 @@ var ts; var type = typeChecker.getTypeFromTypeNode(typeNode); if (!typeChecker.isTypeAssignableTo(typeChecker.getUndefinedType(), type)) { var types = ts.isUnionTypeNode(typeNode) ? typeNode.types : [typeNode]; - return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)], false)); + return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)], false)); } } return typeNode; @@ -448031,7 +449635,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 208 /* SyntaxKind.CallExpression */ : 209 /* SyntaxKind.NewExpression */; + var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 210 /* SyntaxKind.CallExpression */ : 211 /* SyntaxKind.NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind; }); if (!node) { return []; @@ -448157,7 +449761,7 @@ var ts; return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, info.prop.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker, sourceFile, info) { - var undefinedTypeNode = ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + var undefinedTypeNode = ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); var types = ts.isUnionTypeNode(info.type) ? info.type.types.concat(undefinedTypeNode) : [info.type, undefinedTypeNode]; var unionTypeNode = ts.factory.createUnionTypeNode(types); if (info.isJs) { @@ -448203,7 +449807,7 @@ var ts; } else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); - if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 128 /* ModifierFlags.Abstract */)) + if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 256 /* ModifierFlags.Abstract */)) return undefined; var constructorDeclaration = ts.getFirstConstructorWithBody(classDeclaration); if (constructorDeclaration && constructorDeclaration.parameters.length) @@ -448380,7 +449984,7 @@ var ts; function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); ts.Debug.assert(token.kind === 100 /* SyntaxKind.ImportKeyword */, "This token should be an ImportKeyword"); - ts.Debug.assert(token.parent.kind === 200 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); + ts.Debug.assert(token.parent.kind === 202 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); return token.parent; } function doChange(changes, sourceFile, importType) { @@ -448509,7 +450113,7 @@ var ts; var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); }); var parameter = ts.first(indexSignature.parameters); var mappedTypeParameter = ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.cast(parameter.name, ts.isIdentifier), parameter.type); - var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, + var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, /*nameType*/ undefined, indexSignature.questionToken, indexSignature.type, /*members*/ undefined); var intersectionType = ts.factory.createIntersectionTypeNode(__spreadArray(__spreadArray(__spreadArray([], ts.getAllSuperTypeNodes(container), true), [ @@ -448567,7 +450171,7 @@ var ts; }, }); function makeChange(changeTracker, sourceFile, span) { - var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 132 /* SyntaxKind.AwaitKeyword */; }); + var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 133 /* SyntaxKind.AwaitKeyword */; }); var awaitExpression = awaitKeyword && ts.tryCast(awaitKeyword.parent, ts.isAwaitExpression); if (!awaitExpression) { return; @@ -448634,28 +450238,45 @@ var ts; errorCodes: errorCodes, getCodeActions: function getCodeActionsToConvertConstToLet(context) { var sourceFile = context.sourceFile, span = context.span, program = context.program; - var range = getConstTokenRange(sourceFile, span.start, program); - if (range === undefined) + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) return; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, range); }); - return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_const_to_let)]; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, info.token); }); + return [codefix.createCodeFixActionMaybeFixAll(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_all_const_to_let)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + var seen = new ts.Map(); + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info) { + if (ts.addToSeen(seen, ts.getSymbolId(info.symbol))) { + return doChange(changes, diag.file, info.token); + } + } + return undefined; + }); + })); }, fixIds: [fixId] }); - function getConstTokenRange(sourceFile, pos, program) { + function getInfo(sourceFile, pos, program) { var _a; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(ts.getTokenAtPosition(sourceFile, pos)); + if (symbol === undefined) + return; var declaration = ts.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.parent, ts.isVariableDeclarationList); if (declaration === undefined) return; var constToken = ts.findChildOfKind(declaration, 85 /* SyntaxKind.ConstKeyword */, sourceFile); if (constToken === undefined) return; - return ts.createRange(constToken.pos, constToken.end); + return { symbol: symbol, token: constToken }; } - function doChange(changes, sourceFile, range) { - changes.replaceRangeWithText(sourceFile, range, "let"); + function doChange(changes, sourceFile, token) { + changes.replaceNode(sourceFile, token, ts.factory.createToken(119 /* SyntaxKind.LetKeyword */)); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -448830,7 +450451,6 @@ var ts; return { edits: edits, renameFilename: undefined, renameLocation: undefined }; }, }); - ; function getInfo(context, considerPartialSpans) { if (considerPartialSpans === void 0) { considerPartialSpans = true; } var file = context.file, program = context.program; @@ -448842,8 +450462,8 @@ var ts; } var checker = program.getTypeChecker(); var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker); - var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); - var wasDefault = !!(flags & 512 /* ModifierFlags.Default */); + var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 1025 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); + var wasDefault = !!(flags & 1024 /* ModifierFlags.Default */); // If source file already has a default export, don't offer refactor. if (!(flags & 1 /* ModifierFlags.Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* InternalSymbolName.Default */)) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) }; @@ -448853,19 +450473,19 @@ var ts; : { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) }; }; switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: { var node = exportNode; if (!node.name) return undefined; return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var vs = exportNode; // Must be `export const x = something;`. if (!(vs.declarationList.flags & 2 /* NodeFlags.Const */) || vs.declarationList.declarations.length !== 1) { @@ -448878,7 +450498,7 @@ var ts; return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var node = exportNode; if (node.isExportEquals) return undefined; @@ -448908,12 +450528,12 @@ var ts; else { var exportKeyword = ts.Debug.checkDefined(ts.findModifier(exportNode, 93 /* SyntaxKind.ExportKeyword */), "Should find an export keyword in modifier list"); switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.factory.createToken(88 /* SyntaxKind.DefaultKeyword */)); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // If 'x' isn't used in this file and doesn't have type definition, `export const x = 0;` --> `export default 0;` var decl = ts.first(exportNode.declarationList.declarations); if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { @@ -448922,9 +450542,9 @@ var ts; break; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // `export type T = number;` -> `type T = number; export default T;` changes.deleteModifier(exportingSourceFile, exportKeyword); changes.insertNodeAfter(exportingSourceFile, exportNode, ts.factory.createExportDefault(ts.factory.createIdentifier(exportName.text))); @@ -448953,18 +450573,18 @@ var ts; function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.default` --> `a.foo` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier(exportName)); break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: { var spec = parent; // `default as foo` --> `foo`, `default as bar` --> `foo as bar` changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); break; } - case 267 /* SyntaxKind.ImportClause */: { + case 270 /* SyntaxKind.ImportClause */: { var clause = parent; ts.Debug.assert(clause.name === ref, "Import clause name should match provided ref"); var spec = makeImportSpecifier(exportName, ref.text); @@ -448973,7 +450593,7 @@ var ts; // `import foo from "./a";` --> `import { foo } from "./a";` changes.replaceNode(importingSourceFile, ref, ts.factory.createNamedImports([spec])); } - else if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + else if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";` changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* QuotePreference.Double */; @@ -448987,7 +450607,7 @@ var ts; } break; } - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: var importTypeNode = parent; changes.replaceNode(importingSourceFile, parent, ts.factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, ts.factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); break; @@ -448998,11 +450618,11 @@ var ts; function changeNamedToDefaultImport(importingSourceFile, ref, changes) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.foo` --> `a.default` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier("default")); break; - case 270 /* SyntaxKind.ImportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: { // `import { foo } from "./a";` --> `import foo from "./a";` // `import { foo as bar } from "./a";` --> `import bar from "./a";` var defaultImport = ts.factory.createIdentifier(parent.name.text); @@ -449015,7 +450635,7 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // `export { foo } from "./a";` --> `export { default as foo } from "./a";` // `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";` // `export { foo as default } from "./a";` --> `export { default } from "./a";` @@ -449116,7 +450736,7 @@ var ts; if (!importClause.namedBindings) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_namespace_import_or_named_imports) }; } - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return { convertTo: 0 /* ImportKind.Named */, import: importClause.namedBindings }; } var shouldUseDefault = getShouldUseDefault(context.program, importClause); @@ -449307,7 +450927,6 @@ var ts; }); return { edits: edits, renameFilename: undefined, renameLocation: undefined }; } - ; function isValidExpression(node) { return ts.isBinaryExpression(node) || ts.isConditionalExpression(node); } @@ -449355,7 +450974,6 @@ var ts; if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) }; } - ; var finalExpression = getFinalExpressionInChain(expression.right); if (!finalExpression) return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) }; @@ -449565,27 +451183,27 @@ var ts; var lastDeclaration = signatureDecls[signatureDecls.length - 1]; var updated = lastDeclaration; switch (lastDeclaration.kind) { - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { updated = ts.factory.updateMethodSignature(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { updated = ts.factory.updateMethodDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { updated = ts.factory.updateCallSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { updated = ts.factory.updateConstructorDeclaration(lastDeclaration, lastDeclaration.modifiers, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.body); break; } - case 175 /* SyntaxKind.ConstructSignature */: { + case 177 /* SyntaxKind.ConstructSignature */: { updated = ts.factory.updateConstructSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { updated = ts.factory.updateFunctionDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } @@ -449616,7 +451234,7 @@ var ts; } function convertParameterToNamedTupleMember(p) { ts.Debug.assert(ts.isIdentifier(p.name)); // This is checked during refactoring applicability checking - var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)), p); + var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)), p); var parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); if (parameterDocComment) { var newComment = ts.displayPartsToString(parameterDocComment); @@ -449636,12 +451254,12 @@ var ts; } function isConvertableSignatureDeclaration(d) { switch (d.kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: return true; } return false; @@ -449760,8 +451378,8 @@ var ts; var i = 0; for (var _i = 0, extractions_1 = extractions; _i < extractions_1.length; _i++) { var _a = extractions_1[_i], functionExtraction = _a.functionExtraction, constantExtraction = _a.constantExtraction; - var description = functionExtraction.description; if (refactor.refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) { + var description = functionExtraction.description; if (functionExtraction.errors.length === 0) { // Don't issue refactorings with duplicated names. // Scopes come back in "innermost first" order, so extractions will @@ -449785,15 +451403,15 @@ var ts; } } if (refactor.refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { + var description = constantExtraction.description; if (constantExtraction.errors.length === 0) { // Don't issue refactorings with duplicated names. // Scopes come back in "innermost first" order, so extractions will // preferentially go into nearer scopes - var description_1 = constantExtraction.description; - if (!usedConstantNames.has(description_1)) { - usedConstantNames.set(description_1, true); + if (!usedConstantNames.has(description)) { + usedConstantNames.set(description, true); constantActions.push({ - description: description_1, + description: description, name: "constant_scope_".concat(i), kind: extractConstantAction.kind }); @@ -449938,7 +451556,6 @@ var ts; var start = cursorRequest ? getExtractableParent(startToken) : ts.getParentNodeInSpan(startToken, sourceFile, adjustedSpan); // Do the same for the ending position var end = cursorRequest ? start : ts.getParentNodeInSpan(endToken, sourceFile, adjustedSpan); - var declarations = []; // We'll modify these flags as we walk the tree to collect data // about what things need to be done as part of the extraction. var rangeFacts = RangeFacts.None; @@ -449981,7 +451598,7 @@ var ts; // the expression. return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; } - return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; + return { targetRange: { range: statements, facts: rangeFacts, thisNode: thisNode } }; } if (ts.isReturnStatement(start) && !start.expression) { // Makes no sense to extract an expression-less return statement. @@ -449993,7 +451610,7 @@ var ts; if (errors) { return { errors: errors }; } - return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217 + return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode: thisNode } }; // TODO: GH#18217 /** * Attempt to refine the extraction node (generally, by shrinking it) to produce better results. * @param node The unrefined extraction node. @@ -450005,10 +451622,10 @@ var ts; } } else if (ts.isVariableStatement(node) || ts.isVariableDeclarationList(node)) { - var declarations_6 = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations; + var declarations = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations; var numInitializers = 0; var lastInitializer = void 0; - for (var _i = 0, declarations_5 = declarations_6; _i < declarations_5.length; _i++) { + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; if (declaration.initializer) { numInitializers++; @@ -450036,20 +451653,20 @@ var ts; function checkForStaticContext(nodeToCheck, containingClass) { var current = nodeToCheck; while (current !== containingClass) { - if (current.kind === 167 /* SyntaxKind.PropertyDeclaration */) { + if (current.kind === 169 /* SyntaxKind.PropertyDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 164 /* SyntaxKind.Parameter */) { + else if (current.kind === 166 /* SyntaxKind.Parameter */) { var ctorOrMethod = ts.getContainingFunction(current); - if (ctorOrMethod.kind === 171 /* SyntaxKind.Constructor */) { + if (ctorOrMethod.kind === 173 /* SyntaxKind.Constructor */) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 169 /* SyntaxKind.MethodDeclaration */) { + else if (current.kind === 171 /* SyntaxKind.MethodDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } @@ -450087,9 +451704,9 @@ var ts; visit(nodeToCheck); if (rangeFacts & RangeFacts.UsesThis) { var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false); - if (container.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) || - container.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (container.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) || + container.kind === 215 /* SyntaxKind.FunctionExpression */) { rangeFacts |= RangeFacts.UsesThisInFunction; } } @@ -450100,7 +451717,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 254 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 257 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; if (ts.hasSyntacticModifier(declaringNode, 1 /* ModifierFlags.Export */)) { // TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`) // Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`! @@ -450108,20 +451725,19 @@ var ts; (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; } - declarations.push(node.symbol); } // Some things can't be extracted in certain situations switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; case 106 /* SyntaxKind.SuperKeyword */: // For a super *constructor call*, we have to be extracting the entire class, // but a super *method call* simply implies a 'this' reference - if (node.parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.parent.kind === 210 /* SyntaxKind.CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); if (containingClass_1 === undefined || containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -450134,7 +451750,7 @@ var ts; thisNode = node; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // check if arrow function uses this ts.forEachChild(node, function check(n) { if (ts.isThis(n)) { @@ -450149,39 +451765,39 @@ var ts; } }); // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); } // falls through - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // do not dive into functions or classes return false; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: permittedJumps &= ~4 /* PermittedJumps.Return */; break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* PermittedJumps.None */; break; - case 235 /* SyntaxKind.Block */: - if (node.parent && node.parent.kind === 252 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { + case 238 /* SyntaxKind.Block */: + if (node.parent && node.parent.kind === 255 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* PermittedJumps.Return */; } break; - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* PermittedJumps.Break */; break; @@ -450193,20 +451809,20 @@ var ts; break; } switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; thisNode = node; break; - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); ts.forEachChild(node, visit); seenLabels.pop(); break; } - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: { + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: { var label = node.label; if (label) { if (!ts.contains(seenLabels, label.escapedText)) { @@ -450215,20 +451831,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 246 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { + if (!(permittedJumps & (node.kind === 249 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: if (permittedJumps & 4 /* PermittedJumps.Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -450298,7 +451914,7 @@ var ts; while (true) { current = current.parent; // A function parameter's initializer is actually in the outer scope, not the function declaration - if (current.kind === 164 /* SyntaxKind.Parameter */) { + if (current.kind === 166 /* SyntaxKind.Parameter */) { // Skip all the way to the outer scope of the function that declared this parameter current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent; } @@ -450309,7 +451925,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 305 /* SyntaxKind.SourceFile */) { + if (current.kind === 308 /* SyntaxKind.SourceFile */) { return scopes; } } @@ -450399,32 +452015,32 @@ var ts; } function getDescriptionForFunctionLikeDeclaration(scope) { switch (scope.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return scope.name ? "function '".concat(scope.name.text, "'") : ts.ANONYMOUS; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return "arrow function"; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return "method '".concat(scope.name.getText(), "'"); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return "'get ".concat(scope.name.getText(), "'"); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return "'set ".concat(scope.name.getText(), "'"); default: throw ts.Debug.assertNever(scope, "Unexpected scope kind ".concat(scope.kind)); } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 257 /* SyntaxKind.ClassDeclaration */ + return scope.kind === 260 /* SyntaxKind.ClassDeclaration */ ? scope.name ? "class '".concat(scope.name.text, "'") : "anonymous class declaration" : scope.name ? "class expression '".concat(scope.name.text, "'") : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 262 /* SyntaxKind.ModuleBlock */ + return scope.kind === 265 /* SyntaxKind.ModuleBlock */ ? "namespace '".concat(scope.parent.name.getText(), "'") : scope.externalModuleIndicator ? 0 /* SpecialScope.Module */ : 1 /* SpecialScope.Global */; } @@ -450497,7 +452113,7 @@ var ts; modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } if (range.facts & RangeFacts.IsAsyncFunction) { - modifiers.push(ts.factory.createModifier(131 /* SyntaxKind.AsyncKeyword */)); + modifiers.push(ts.factory.createModifier(132 /* SyntaxKind.AsyncKeyword */)); } newFunction = ts.factory.createMethodDeclaration(modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, /*questionToken*/ undefined, typeParameters, parameters, returnType, body); @@ -450511,7 +452127,7 @@ var ts; /*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NodeBuilderFlags.NoTruncation */), /*initializer*/ undefined)); } - newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(131 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); + newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(132 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); } var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end; @@ -450659,9 +452275,9 @@ var ts; while (ts.isParenthesizedTypeNode(withoutParens)) { withoutParens = withoutParens.type; } - return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 153 /* SyntaxKind.UndefinedKeyword */; }) + return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 155 /* SyntaxKind.UndefinedKeyword */; }) ? clone - : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } } /** @@ -450692,7 +452308,7 @@ var ts; if (rangeFacts & RangeFacts.InStaticRegion) { modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } - modifiers.push(ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); + modifiers.push(ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); var newVariable = ts.factory.createPropertyDeclaration(modifiers, localNameText, /*questionToken*/ undefined, variableType, initializer); var localReference = ts.factory.createPropertyAccessExpression(rangeFacts & RangeFacts.InStaticRegion @@ -450723,7 +452339,7 @@ var ts; var localReference = ts.factory.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { // If the parent is an expression statement and the target scope is the immediately enclosing one, // replace the statement with the declaration. var newVariableStatement = ts.factory.createVariableStatement( @@ -450742,7 +452358,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.delete(context.file, node.parent); } @@ -451388,30 +453004,30 @@ var ts; function isExtractableExpression(node) { var parent = node.parent; switch (parent.kind) { - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return false; } switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: - return parent.kind !== 266 /* SyntaxKind.ImportDeclaration */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */; - case 225 /* SyntaxKind.SpreadElement */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 203 /* SyntaxKind.BindingElement */: + return parent.kind !== 269 /* SyntaxKind.ImportDeclaration */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */; + case 227 /* SyntaxKind.SpreadElement */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 205 /* SyntaxKind.BindingElement */: return false; case 79 /* SyntaxKind.Identifier */: - return parent.kind !== 203 /* SyntaxKind.BindingElement */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */ && - parent.kind !== 275 /* SyntaxKind.ExportSpecifier */; + return parent.kind !== 205 /* SyntaxKind.BindingElement */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */ && + parent.kind !== 278 /* SyntaxKind.ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 305 /* SyntaxKind.SourceFile */: - case 262 /* SyntaxKind.ModuleBlock */: - case 289 /* SyntaxKind.CaseClause */: + case 238 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 265 /* SyntaxKind.ModuleBlock */: + case 292 /* SyntaxKind.CaseClause */: return true; default: return false; @@ -451699,7 +453315,6 @@ var ts; (function (ts) { var refactor; (function (refactor) { - ; /** * Checks if some refactor info has refactor error info. */ @@ -451804,15 +453419,14 @@ var ts; // Imports will be copied to the new file anyway, and may still be needed in the old file. // Prologue directives will be copied to the new file and should be left in the old file. return !isPureImport(statement) && !ts.isPrologueDirective(statement); - ; } function isPureImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return true; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return !ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); }); default: return false; @@ -451835,7 +453449,7 @@ var ts; function getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences) { var checker = program.getTypeChecker(); var prologueDirectives = ts.takeWhile(oldFile.statements, ts.isPrologueDirective); - if (!oldFile.externalModuleIndicator && !oldFile.commonJsModuleIndicator) { + if (oldFile.externalModuleIndicator === undefined && oldFile.commonJsModuleIndicator === undefined && usage.oldImportsNeededByNewFile.size() === 0) { deleteMovedStatements(oldFile, toMove.ranges, changes); return __spreadArray(__spreadArray([], prologueDirectives, true), toMove.all, true); } @@ -451908,12 +453522,12 @@ var ts; } function getNamespaceLikeImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? + case 269 /* SyntaxKind.ImportDeclaration */: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? node.importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.tryCast(node.name, ts.isIdentifier); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); @@ -451944,21 +453558,21 @@ var ts; var newNamespaceId = ts.factory.createIdentifier(newNamespaceName); var newModuleString = ts.factory.createStringLiteral(newModuleSpecifier); switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, ts.factory.createNamespaceImport(newNamespaceId)), newModuleString, /*assertClause*/ undefined); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.createImportEqualsDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, newNamespaceId, ts.factory.createExternalModuleReference(newModuleString)); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.factory.createVariableDeclaration(newNamespaceId, /*exclamationToken*/ undefined, /*type*/ undefined, createRequireCall(newModuleString)); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); } } function moduleSpecifierFromImport(i) { - return (i.kind === 266 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier - : i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression + return (i.kind === 269 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier + : i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]); } function forEachImportInStatement(statement, cb) { @@ -452028,15 +453642,15 @@ var ts; } function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { switch (importDecl.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (isUnused(importDecl.name)) { changes.delete(sourceFile, importDecl); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); break; default: @@ -452049,7 +453663,7 @@ var ts; var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings; var defaultUnused = !name || isUnused(name); var namedBindingsUnused = !namedBindings || - (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); + (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); if (defaultUnused && namedBindingsUnused) { changes.delete(sourceFile, importDecl); } @@ -452061,7 +453675,7 @@ var ts; if (namedBindingsUnused) { changes.replaceNode(sourceFile, importDecl.importClause, ts.factory.updateImportClause(importDecl.importClause, importDecl.importClause.isTypeOnly, name, /*namedBindings*/ undefined)); } - else if (namedBindings.kind === 269 /* SyntaxKind.NamedImports */) { + else if (namedBindings.kind === 272 /* SyntaxKind.NamedImports */) { for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) { var element = _b[_i]; if (isUnused(element.name)) @@ -452076,12 +453690,17 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: if (isUnused(name)) { - changes.delete(sourceFile, name); + if (varDecl.initializer && ts.isRequireCall(varDecl.initializer, /*requireStringLiteralLikeArgument*/ true)) { + changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && ts.length(varDecl.parent.declarations) === 1 ? varDecl.parent.parent : varDecl); + } + else { + changes.delete(sourceFile, name); + } } break; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: break; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) { changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl); } @@ -452123,7 +453742,7 @@ var ts; if (markSeenTop(top)) { addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); } - if (ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */)) { oldFileDefault = name; } else { @@ -452211,14 +453830,14 @@ var ts; // Below should all be utilities function isInImport(decl) { switch (decl.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return isVariableDeclarationInImport(decl); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return false; @@ -452230,7 +453849,7 @@ var ts; } function filterImport(i, moduleSpecifier, keep) { switch (i.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { var clause = i.importClause; if (!clause) return undefined; @@ -452240,9 +453859,9 @@ var ts; ? ts.factory.createImportDeclaration(/*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, defaultImport, namedBindings), moduleSpecifier, /*assertClause*/ undefined) : undefined; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return keep(i.name) ? i : undefined; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var name = filterBindingName(i.name, keep); return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined; } @@ -452251,7 +453870,7 @@ var ts; } } function filterNamedBindings(namedBindings, keep) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return keep(namedBindings.name) ? namedBindings : undefined; } else { @@ -452263,9 +453882,9 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return keep(name) ? name : undefined; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return name; - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { // We can't handle nested destructurings or property names well here, so just copy them all. var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); }); return newElements.length ? ts.factory.createObjectBindingPattern(newElements) : undefined; @@ -452308,6 +453927,9 @@ var ts; ts.copyEntries(this.map, clone.map); return clone; }; + SymbolSet.prototype.size = function () { + return this.map.size; + }; return SymbolSet; }()); function isTopLevelDeclaration(node) { @@ -452322,13 +453944,13 @@ var ts; } function isNonVariableTopLevelDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -452336,17 +453958,17 @@ var ts; } function forEachTopLevelDeclaration(statement, cb) { switch (statement.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return cb(statement); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* AssignmentDeclarationKind.ExportsProperty */ ? cb(statement) @@ -452358,8 +453980,8 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); })); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); }); default: return ts.Debug.assertNever(name, "Unexpected name kind ".concat(name.kind)); @@ -452370,9 +453992,9 @@ var ts; } function getTopLevelDeclarationStatement(d) { switch (d.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return d.parent.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); })); default: return d; @@ -452396,7 +454018,8 @@ var ts; if (useEs6Exports) { return !ts.isExpressionStatement(decl) && ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */) || !!(name && ((_a = sourceFile.symbol.exports) === null || _a === void 0 ? void 0 : _a.has(name.escapedText))); } - return getNamesToExportInCommonJS(decl).some(function (name) { return sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(name)); }); + return !!sourceFile.symbol && !!sourceFile.symbol.exports && + getNamesToExportInCommonJS(decl).some(function (name) { return sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(name)); }); } function addExport(decl, useEs6Exports) { return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl); @@ -452404,24 +454027,24 @@ var ts; function addEs6Export(d) { var modifiers = ts.canHaveModifiers(d) ? ts.concatenate([ts.factory.createModifier(93 /* SyntaxKind.ExportKeyword */)], ts.getModifiers(d)) : undefined; switch (d.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var decorators = ts.canHaveDecorators(d) ? ts.getDecorators(d) : undefined; return ts.factory.updateClassDeclaration(d, ts.concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.factory.updateVariableStatement(d, modifiers, d.declarationList); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.factory.updateModuleDeclaration(d, modifiers, d.name, d.body); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.factory.updateEnumDeclaration(d, modifiers, d.name, d.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return ts.factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(d, "Unexpected declaration kind ".concat(d.kind)); @@ -452432,18 +454055,18 @@ var ts; } function getNamesToExportInCommonJS(decl) { switch (decl.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return [decl.name.text]; // TODO: GH#18217 - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; }); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.emptyArray; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail("Can't export an ExpressionStatement"); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(decl, "Unexpected decl kind ".concat(decl.kind)); @@ -452784,15 +454407,15 @@ var ts; var parent = functionReference.parent; switch (parent.kind) { // foo(...) or super(...) or new Foo(...) - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression); if (callOrNewExpression && callOrNewExpression.expression === functionReference) { return callOrNewExpression; } break; // x.foo(...) - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression); @@ -452802,7 +454425,7 @@ var ts; } break; // x["foo"](...) - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression); @@ -452821,14 +454444,14 @@ var ts; var parent = reference.parent; switch (parent.kind) { // `C.foo` - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } break; // `C["foo"]` - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.expression === reference) { return elementAccessExpression; @@ -452874,16 +454497,16 @@ var ts; if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) return false; switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralExpression(functionDeclaration.parent)) { var contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); // don't offer the refactor when there are multiple signatures since we won't know which ones the user wants to change return ((_a = contextualSymbol === null || contextualSymbol === void 0 ? void 0 : contextualSymbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 && isSingleImplementation(functionDeclaration, checker); } return isSingleImplementation(functionDeclaration, checker); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (ts.isClassDeclaration(functionDeclaration.parent)) { return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); } @@ -452891,8 +454514,8 @@ var ts; return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return isValidVariableDeclaration(functionDeclaration.parent); } return false; @@ -453040,7 +454663,7 @@ var ts; } function getClassNames(constructorDeclaration) { switch (constructorDeclaration.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = constructorDeclaration.parent; if (classDeclaration.name) return [classDeclaration.name]; @@ -453048,7 +454671,7 @@ var ts; // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(classDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless class declaration should be a default export"); return [defaultModifier]; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var classExpression = constructorDeclaration.parent; var variableDeclaration = constructorDeclaration.parent.parent; var className = classExpression.name; @@ -453059,25 +454682,25 @@ var ts; } function getFunctionNames(functionDeclaration) { switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (functionDeclaration.name) return [functionDeclaration.name]; // If the function declaration doesn't have a name, it should have a default modifier. // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(functionDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless function declaration should be a default export"); return [defaultModifier]; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return [functionDeclaration.name]; - case 171 /* SyntaxKind.Constructor */: - var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 134 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); - if (functionDeclaration.parent.kind === 226 /* SyntaxKind.ClassExpression */) { + case 173 /* SyntaxKind.Constructor */: + var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 135 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); + if (functionDeclaration.parent.kind === 228 /* SyntaxKind.ClassExpression */) { var variableDeclaration = functionDeclaration.parent.parent; return [variableDeclaration.name, ctrKeyword]; } return [ctrKeyword]; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return [functionDeclaration.parent.name]; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (functionDeclaration.name) return [functionDeclaration.name, functionDeclaration.parent.name]; return [functionDeclaration.parent.name]; @@ -453168,11 +454791,11 @@ var ts; function getParentBinaryExpression(expr) { var container = ts.findAncestor(expr.parent, function (n) { switch (n.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return false; - case 223 /* SyntaxKind.TemplateExpression */: - case 221 /* SyntaxKind.BinaryExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return !(ts.isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); default: return "quit"; @@ -453620,10 +455243,10 @@ var ts; } function isConvertibleDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return true; default: return false; @@ -453668,7 +455291,7 @@ var ts; this.kind = kind; } NodeObject.prototype.assertHasRealPosition = function (message) { - // eslint-disable-next-line debug-assert + // eslint-disable-next-line local/debug-assert ts.Debug.assert(!ts.positionIsSynthesized(this.pos) && !ts.positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); }; NodeObject.prototype.getSourceFile = function () { @@ -453725,8 +455348,8 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 309 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 347 /* SyntaxKind.LastJSDocNode */; }); - return child.kind < 161 /* SyntaxKind.FirstNode */ ? + var child = ts.find(children, function (kid) { return kid.kind < 312 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 350 /* SyntaxKind.LastJSDocNode */; }); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getFirstToken(sourceFile); }; @@ -453737,7 +455360,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 161 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); }; NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { return ts.forEachChild(this, cbNode, cbNodeArray); @@ -453797,7 +455420,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(348 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(351 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { @@ -454146,7 +455769,7 @@ var ts; var _a; if (!seenSymbols_1.has(symbol)) { seenSymbols_1.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualJsDocTags(declaration, checker); } return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined; @@ -454156,8 +455779,8 @@ var ts; tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true); } }; - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; _loop_20(declaration); } } @@ -454173,7 +455796,7 @@ var ts; var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) { if (!seenSymbols_2.has(symbol)) { seenSymbols_2.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualDocumentationComment(declaration, checker); } return symbol.getDocumentationComment(checker); @@ -454183,8 +455806,8 @@ var ts; if (inheritedDocs) doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc); }; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; _loop_21(declaration); } } @@ -454192,7 +455815,7 @@ var ts; } function findBaseOfDeclaration(checker, declaration, cb) { var _a; - var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; + var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; if (!classOrInterfaceDeclaration) return; var isStaticMember = ts.hasStaticModifier(declaration); @@ -454207,7 +455830,7 @@ var ts; __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { var _this = _super.call(this, kind, pos, end) || this; - _this.kind = 305 /* SyntaxKind.SourceFile */; + _this.kind = 308 /* SyntaxKind.SourceFile */; return _this; } SourceFileObject.prototype.update = function (newText, textChangeRange) { @@ -454266,10 +455889,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -454289,31 +455912,31 @@ var ts; } ts.forEachChild(node, visit); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 184 /* SyntaxKind.TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Only consider parameter properties if (!ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { break; } // falls through - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -454324,12 +455947,12 @@ var ts; } } // falls through - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: addDeclaration(node); break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; var exportDeclaration = node; @@ -454342,7 +455965,7 @@ var ts; } } break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -454354,7 +455977,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -454363,7 +455986,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) !== 0 /* AssignmentDeclarationKind.None */) { addDeclaration(node); } @@ -454709,7 +456332,7 @@ var ts; var rootFileNames = host.getScriptFileNames().slice(); // Get a fresh cache of the host information var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host); var parsedCommandLines; @@ -454740,7 +456363,7 @@ var ts; }, onReleaseOldSourceFile: onReleaseOldSourceFile, onReleaseParsedCommandLine: onReleaseParsedCommandLine, - hasInvalidatedResolution: hasInvalidatedResolution, + hasInvalidatedResolutions: hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames, trace: ts.maybeBind(host, host.trace), resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames), @@ -454775,8 +456398,12 @@ var ts; getCurrentDirectory: compilerHost.getCurrentDirectory, onUnRecoverableConfigFileDiagnostic: ts.noop, }; + // The call to isProgramUptoDate below may refer back to documentRegistryBucketKey; + // calculate this early so it's not undefined if downleveled to a var (or, if emitted + // as a const variable without downleveling, doesn't crash). + var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); // If the program is already up-to-date, we can reuse it - if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { return; } // IMPORTANT - It is critical from this moment onward that we do not check @@ -454784,7 +456411,6 @@ var ts; // instance. If we cancel midway through, we may end up in an inconsistent state where // the program points to old source files that have been invalidated because of // incremental parsing. - var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); var options = { rootNames: rootFileNames, options: newSettings, @@ -455080,16 +456706,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return !ts.isLabelName(node) && !ts.isTagName(node) && !ts.isConstTypeReference(node.parent); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: // Don't return quickInfo if inside the comment in `a/**/.b` return !ts.isInComment(sourceFile, position); case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 106 /* SyntaxKind.SuperKeyword */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return true; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return ts.isImportMeta(node); default: return false; @@ -455196,15 +456822,15 @@ var ts; return undefined; } switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: case 10 /* SyntaxKind.StringLiteral */: case 95 /* SyntaxKind.FalseKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 106 /* SyntaxKind.SuperKeyword */: case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 79 /* SyntaxKind.Identifier */: break; // Cant create the text span @@ -455221,7 +456847,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -455351,12 +456977,14 @@ var ts; return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences }); } function organizeImports(args, formatOptions, preferences) { + var _a; if (preferences === void 0) { preferences = ts.emptyOptions; } synchronizeHostData(); ts.Debug.assert(args.type === "file"); var sourceFile = getValidSourceFile(args.fileName); var formatContext = ts.formatting.getFormatContext(formatOptions, host); - return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, args.skipDestructiveCodeActions); + var mode = (_a = args.mode) !== null && _a !== void 0 ? _a : (args.skipDestructiveCodeActions ? "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ : "All" /* OrganizeImportsMode.All */); + return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, mode); } function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) { if (preferences === void 0) { preferences = ts.emptyOptions; } @@ -455970,7 +457598,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 277 /* SyntaxKind.ExternalModuleReference */ || + node.parent.kind === 280 /* SyntaxKind.ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -455988,13 +457616,13 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; } // falls through case 79 /* SyntaxKind.Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 286 /* SyntaxKind.JsxAttributes */) && + (node.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 289 /* SyntaxKind.JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -456036,7 +457664,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -456129,114 +457757,114 @@ var ts; if (node) { var parent = node.parent; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return spanInVariableDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return spanInParameterDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return spanInFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanInBlock(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInBlock(node.block); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: // span in statement return spanInNode(node.statement); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return spanInForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 203 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 205 /* SyntaxKind.BindingElement */: // span on complete node return textSpan(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: // span in statement return spanInNode(node.statement); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return spanInNodeArray(parent.modifiers, node, ts.isDecorator); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return undefined; // Tokens: case 26 /* SyntaxKind.SemicolonToken */: @@ -456266,7 +457894,7 @@ var ts; case 83 /* SyntaxKind.CatchKeyword */: case 96 /* SyntaxKind.FinallyKeyword */: return spanInNextNode(node); - case 160 /* SyntaxKind.OfKeyword */: + case 162 /* SyntaxKind.OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -456279,13 +457907,13 @@ var ts; // `a` or `...c` or `d: x` from // `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern if ((node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 225 /* SyntaxKind.SpreadElement */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) && + node.kind === 227 /* SyntaxKind.SpreadElement */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) { return textSpan(node); } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { var _a = node, left = _a.left, operatorToken = _a.operatorToken; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -456307,22 +457935,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (parent.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return textSpan(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -456331,21 +457959,21 @@ var ts; } } switch (node.parent.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // If this is name of property assignment, set breakpoint in the initializer if (node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) { @@ -456353,7 +457981,7 @@ var ts; } break; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -456383,7 +458011,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } var parent = variableDeclaration.parent; @@ -456395,7 +458023,7 @@ var ts; // or its declaration from 'for of' if ((ts.hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer) || ts.hasSyntacticModifier(variableDeclaration, 1 /* ModifierFlags.Export */) || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -456436,7 +458064,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasSyntacticModifier(functionDeclaration, 1 /* ModifierFlags.Export */) || - (functionDeclaration.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 171 /* SyntaxKind.Constructor */); + (functionDeclaration.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 173 /* SyntaxKind.Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -456459,26 +458087,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -456503,21 +458131,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 203 /* SyntaxKind.BindingElement */) { + if (bindingPattern.parent.kind === 205 /* SyntaxKind.BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 202 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 201 /* SyntaxKind.ObjectBindingPattern */); - var elements = node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 204 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 203 /* SyntaxKind.ObjectBindingPattern */); + var elements = node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -456525,18 +458153,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -456544,25 +458172,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // Span on close brace token return textSpan(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -456570,7 +458198,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -456586,7 +458214,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -456601,12 +458229,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 208 /* SyntaxKind.CallExpression */ || - node.parent.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 210 /* SyntaxKind.CallExpression */ || + node.parent.kind === 211 /* SyntaxKind.NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -456615,21 +458243,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -456639,20 +458267,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.parent.kind === 164 /* SyntaxKind.Parameter */) { + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.parent.kind === 166 /* SyntaxKind.Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.parent.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -456660,7 +458288,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -456709,7 +458337,7 @@ var debugObjectHost = (function () { return this; })(); // We need to use 'null' to interface with the managed side. -/* eslint-disable no-in-operator */ +/* eslint-disable local/no-in-operator */ /* @internal */ var ts; (function (ts) { @@ -457509,7 +459137,7 @@ var ts; }()); ts.TypeScriptServicesFactory = TypeScriptServicesFactory; })(ts || (ts = {})); -/* eslint-enable no-in-operator */ +/* eslint-enable local/no-in-operator */ // We polyfill `globalThis` here so re can reliably patch the global scope // in the contexts we want to in the same way across script and module formats /* eslint-enable no-var */ @@ -458279,7 +459907,7 @@ var ts; if (typeof value === "number") { return ts.factory.createNumericLiteral(value); } - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (typeof value === "object" && "base10Value" in value) { // PseudoBigInt return ts.factory.createBigIntLiteral(value); } @@ -458307,7 +459935,7 @@ var ts; } else { type = operatorOrType; - operator = 140 /* SyntaxKind.KeyOfKeyword */; + operator = 141 /* SyntaxKind.KeyOfKeyword */; } return ts.factory.createTypeOperatorNode(operator, type); }, factoryDeprecation); @@ -458485,7 +460113,7 @@ var ts; ts.createNode = ts.Debug.deprecate(function createNode(kind, pos, end) { if (pos === void 0) { pos = 0; } if (end === void 0) { end = 0; } - return ts.setTextRangePosEnd(kind === 305 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : + return ts.setTextRangePosEnd(kind === 308 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : kind === 79 /* SyntaxKind.Identifier */ ? ts.parseBaseNodeFactory.createBaseIdentifierNode(kind) : kind === 80 /* SyntaxKind.PrivateIdentifier */ ? ts.parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : !ts.isNodeKind(kind) ? ts.parseBaseNodeFactory.createBaseTokenNode(kind) : @@ -458515,7 +460143,7 @@ var ts; (function (ts) { /** @deprecated Use `isTypeAssertionExpression` instead. */ ts.isTypeAssertion = ts.Debug.deprecate(function isTypeAssertion(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; }, { since: "4.0", warnAfter: "4.1",